Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17928 invoked from network); 2 Jul 2009 12:03:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2009 12:03:56 -0000 Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:59133] helo=interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 20/50-16153-922AC4A4 for ; Thu, 02 Jul 2009 08:03:53 -0400 Received: by interjinn.com (Postfix, from userid 5001) id D0C8D38C113; Thu, 2 Jul 2009 08:03:42 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gruknuk.suds X-Spam-Level: X-Spam-Status: No, score=-4.4 required=7.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 Received: from [192.168.1.3] (blobbie [192.168.1.3]) by interjinn.com (Postfix) with ESMTPS id BAB8738C112; Thu, 2 Jul 2009 08:03:37 -0400 (EDT) Message-ID: <4A4CA264.8030009@interjinn.com> Date: Thu, 02 Jul 2009 08:04:52 -0400 Organization: InterJinn User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: "Ionut G. Stan" CC: PHP internals References: <4A4C7CE6.6070107@gmail.com> <7f3ed2c30907020356s45fd2c56l30b77e92fec61a8c@mail.gmail.com> <4A4C9A8F.4060107@gmail.com> In-Reply-To: <4A4C9A8F.4060107@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: Type hinting revisited for PHP 5.3 From: robert@interjinn.com (Robert Cummings) Ionut G. Stan wrote: > On 7/2/2009 13:56, Hannes Magnusson wrote: >> > function throw_exception($errno, $errmsg) { >> if (strpos($errmsg, "Argument ") === 0) { >> throw new InvalidArgumentException($errmsg, $errno); >> } >> return false; >> } >> set_error_handler("throw_exception", E_RECOVERABLE_ERROR); >> >> function foo(array $arr) {} >> foo("string"); >> > Actually, I'd use an exception class which extends from the builtin > ErrorException > class, but that's not the point. Anyway, probably Kalle Sommer Nielsen > is right, > and the way PHP already behaves in that regard should be kept. At least > for now. I think it should be E_WARNING with auto type juggling if bad data comes through. This way it behaves as normal PHP code does without special handling to mitigate a script failure. The log files will still alert you to the problem, and if you really want an exception handler then you still have that option. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP