Re: Returning NULL when arg parsing fails - was: Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt
| From: | Matteo Beccati | Date: | Thu, 02 Apr 2009 07:30:45 +0000 |
| Subject: | Re: Returning NULL when arg parsing fails - was: Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43586@lists.php.net to get a copy of this message | ||
Kalle Sommer Nielsen wrote:
> Most of php-src uses validation check the other way around:
>
> if (zend_parse_parameters(...) == FAILURE) {
> ...
> }
>
> But I still don't agree that we should change to return false if
> parameter parsing fails, in most cases it generates a verbal warning
> which no one want in first place with this new API which should make
> people awake of their code is wrong. Ofcourse theres the quite option,
> but still
The point raised on IRC was the opposite: try and unify the code so that
if parameter parsing fails returns NULL, which seems to be the standard.
And yes you're right, there are quite a lot of checks with
zend_parse_parameters(...) == FAILURE.
Attached is the result of a simple script counting both variants and the
numbers of RETURN_FALSE vs total number of matches. Not all are verified
and there could be false positives or missing matches, but approx a
patch would touch 42 files with 304 changes. So I don't think it's a
good idea to fix now, maybe something we might want to do for the next
major release.
About my next PDO changes, barring any objection I will use return false
to keep the behaviour consistent with the current one.
Cheers
--
Matteo Beccati
OpenX - http://www.openx.org