Hi Ilia
Den 30/12/2008 kl. 00.30 skrev Ilia Alshanetsky ilia@prohost.org:
Here is a pretty simple patch that will provide the indicated
function. If no one objects I'll commit it to 5.3/6 branches in the
next day or two.<gethostname.txt>
You should use zend_parse_parameters_none() here.
I have no test env here, but does it work on Windows?
-Kalle
There is nothing wrong with using WRONG_PARAM_COUNT, it worked in the
past and still works fine and quite a bit of code still uses it.
The code itself should work on windows, if the define for the function
is specified.
Hi Ilia
Den 30/12/2008 kl. 00.30 skrev Ilia Alshanetsky ilia@prohost.org:
Here is a pretty simple patch that will provide the indicated
function. If no one objects I'll commit it to 5.3/6 branches in the
next day or two.<gethostname.txt>
You should use zend_parse_parameters_none() here.
I have no test env here, but does it work on Windows?
-Kalle
Ilia Alshanetsky
There is nothing wrong with using WRONG_PARAM_COUNT, it worked in the
past and still works fine and quite a bit of code still uses it.
True, but we're trying to get rid of it, so please use new parameter
parsing API when adding new functions.
Thanks.
--
Wbr,
Antony Dovgal
What is the benefit of the new API, documents better, has a longer
name, helps some fuzzing suit to determine if functions take args or
not?
Also, is this documented anywhere?
There is nothing wrong with using WRONG_PARAM_COUNT, it worked in the
past and still works fine and quite a bit of code still uses it.True, but we're trying to get rid of it, so please use new parameter
parsing API when adding new functions.
Thanks.--
Wbr,
Antony Dovgal
Ilia Alshanetsky
What is the benefit of the new API, documents better, has a longer
name, helps some fuzzing suit to determine if functions take args or
not?
It produces much better & verbose error messages error messages.
Take a look at these for example:
5_3> ./sapi/cli/php -r 'strlen(1,2,3);'
Warning: strlen()
expects exactly 1 parameter, 3 given in Command line code on line 1
5_3> ./sapi/cli/php -r 'strlen(array());'
Warning: strlen()
expects parameter 1 to be string, array given in Command line code on line 1
5_2> ./sapi/cli/php -r 'strlen(1,2,3);'
Warning: Wrong parameter count for strlen()
in Command line code on line 1
Notice the difference?
Also, is this documented anywhere?
.._none() might be not documented, but it's used everywhere.
I believe it should be mentioned in README.PARAMETER_PARSING_API if it's not there yet.
--
Wbr,
Antony Dovgal
What is the benefit of the new API, documents better, has a longer
name, helps some fuzzing suit to determine if functions take args or
not?It produces much better & verbose error messages error messages.
Take a look at these for example:
5_3> ./sapi/cli/php -r 'strlen(1,2,3);'
Warning:strlen()
expects exactly 1 parameter, 3 given in Command
line code on line 15_3> ./sapi/cli/php -r 'strlen(array());'
Warning:strlen()
expects parameter 1 to be string, array given in
Command line code on line 15_2> ./sapi/cli/php -r 'strlen(1,2,3);'
Warning: Wrong parameter count forstrlen()
in Command line code on
line 1Notice the difference?
Cool, that's a good change, I'll keep it mind for future code.
Also, is this documented anywhere?
.._none() might be not documented, but it's used everywhere.
I believe it should be mentioned in README.PARAMETER_PARSING_API if
it's not there yet.
Yes, that would be helpful to have in there.
Ilia Alshanetsky
hi,
Hi Ilia
Den 30/12/2008 kl. 00.30 skrev Ilia Alshanetsky ilia@prohost.org:
Here is a pretty simple patch that will provide the indicated function. If
no one objects I'll commit it to 5.3/6 branches in the next day or two.<gethostname.txt>
You should use zend_parse_parameters_none() here.
I have no test env here, but does it work on Windows?
Yes, I only have to add HAVE_GETHOSTNAME to config.w32.h.in
Cheers,
Pierre