Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58782 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37504 invoked from network); 8 Mar 2012 12:58:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Mar 2012 12:58:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:36463] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/B6-00152-4FCA85F4 for ; Thu, 08 Mar 2012 07:58:29 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 7783F7000436; Thu, 8 Mar 2012 12:58:25 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id Y12yiqE+9h9K; Thu, 8 Mar 2012 12:58:25 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id EF60170003D1; Thu, 8 Mar 2012 12:58:24 +0000 (WET) Received: from slws007.slhq.int (a79-168-248-114.cpe.netcabo.pt [79.168.248.114]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 49FB3201BE03; Thu, 8 Mar 2012 12:58:24 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Ferenc Kovacs" , "Anthony Ferrara" Cc: "Arvids Godjuks" , "Simon Schick" , internals@lists.php.net References: <52.38.15021.3A1E65F4@pb1.pair.com> <4F570EBB.6030103@sugarcrm.com> <60744d7ea642fe03c7110502a3f4276a@mohiva.com> Date: Thu, 08 Mar 2012 13:58:22 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/11.61 (Win32) Subject: Re: [PHP-DEV] Scalar Type Hinting From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Thu, 08 Mar 2012 13:38:32 +0100, Anthony Ferrara wrote: >> AFAIR Gustavo, Anthony and Nikic discussed on IRC, that maybe the best >> solution for scalar type hints would be the unification of the scalar >> type >> hints with the current implementation of zend_parse_parameters. > > Yeah, that's basically what we were discussing. However, there's one > significant issue that I personally have to doing that. in ZPP, if > you have a parameter that expects an array, and pass it an int, a > warning is raised. But then the main body of the function is skipped > (the function isn't executed) and the control is passed back to the > calling code. Not really, that's just a convention that if zpp fails functions return null or false immediately (which one is used depends on the extension, current weather, etc.). That's because there's a convention that builtin functions don't raise exceptions. But nothings stops them from falling back or suppressing the warning/notice (and some do, esp. if they support distinct sets of arguments). Some extensions (and constructors even in extensions that use false for error) actually force an exception if zpp fails (usually via zend_replace_error_handling). But of course this is not an option in user code because: 1) you can't change the error handling before parsing the parameters and 2) inside the function you can't tell whether some argument parsing error occurred. So E_RECOVERABLE_ERROR in the cases where zpp would return FAILURE seems in fact the only viable option, even with the disadvantages it has (centralization and lack of flexibility). Still, the fact that 100% consistency is not possible is not a strong argument against at least *some* consistency and in favor of inventing new rules. > [...] -- Gustavo Lopes