Don't silence chr function arguments error
| From: | Gabriel Caruso | Date: | Sun, 28 Apr 2019 23:05:36 +0000 |
| Subject: | Don't silence chr function arguments error | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-105489@lists.php.net to get a copy of this message | ||
Hello Internals.
I'd like to discuss a small change, but that demands a discussion, for a
function in PHP's Core: https://php.net/chr <http://php.net/chr>.
Currently, if you pass an argument that is not an integer, it will simply
return an empty string: https://3v4l.org/FF2nA. In case you
pass more than
1 argument, it will complain about "Wrong number of arguments":
https://3v4l.org/Yrr43.
The proposal of https://github.com/php/php-src/pull/4080 is to
relly these
checks to ZPP, making the first argument mandatory to an integer, and make
the error message for extra arguments consistent with the rest of the core
functions, e.g. "Warning: chr() expects parameter 1 to be int, string
given".
The idea is to merge in PHP-7.4, but if there's a consensus that this
should go into PHP 8 only, so it is :)
Best,
-- Gabriel Caruso