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: | Kalle Sommer Nielsen | Date: | Thu, 02 Apr 2009 05:51:13 +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 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43584@lists.php.net to get a copy of this message | ||
Hi Matteo
2009/4/1 Matteo Beccati <php@beccati.com>:
> Hi,
>
>> After a quick discussion with Lukas and Antony on IRC, I wrote a small
>> script to detect how many functions/methods are returning false after
>> failing to validate the arguments: you 'll find the result for PHP_5_3
>> attached.
>>
>> The regex I've used is not perfect, but if you think it's somewhat
>> accurate we might want to decide fixing in PHP 5.3 as there aren't many
>> places that need to be fixed.
>
> I don't mean to stress you on this, it's not too bad if we don't fix it.
>
> But I'd just need a suggestion on what to do within the pdo extension as I'm
> supposed to commit a fix for PDO::query() and PDO::setFetchMode() to make
> argument validation more strict and those methods are among the ones that
> return false when argument checks fail.
>
> You'll find a patch for the entire 5.3 php-src, in case you want to take a
> look:
> m{
˜«JË•gÚ{ˆ7
> http://www.beccati.com/misc/php/zend_parse_params_return_false.diff
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
>
>
> Cheers
> --
> Matteo Beccati
>
> OpenX - http://www.openx.org
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Kalle Sommer Nielsen
kalle@php.net