Bug #78579 [Csd]: mb_decode_numericentity: args number inconsistency

From: Date: Sat, 21 Sep 2019 14:41:57 +0000
Subject: Bug #78579 [Csd]: mb_decode_numericentity: args number inconsistency
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222858@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78579&edit=1 ID: 78579 Updated by: cmb@php.net Reported by: fabien dot villepinte at gmail dot com Summary: mb_decode_numericentity: args number inconsistency Status: Closed Type: Bug Package: mbstring related PHP Version: Irrelevant Assigned To: cmb Block user comment: N Private report: N New Comment: > the $is_hex parameter is available as of PHP 5.5.3. Correction: it is available as of PHP 5.4.0. Previous Comments: ------------------------------------------------------------------------ [2019-09-21 14:18:52] cmb@php.net Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=398b3083163ea3571345a235a0b7453394ba0a06 Log: Fix #78579: mb_decode_numericentity: args number inconsistency ------------------------------------------------------------------------ [2019-09-21 13:19:49] cmb@php.net Well, the documentation is correct according to the current implementation[1]. mb_encode_numericentity() and mb_decode_numericentity() share the same ZPP, but the fourth parameter is completely ignored for the latter function. I think it's best to keep the unused parameter for PHP 7, but to fix reflection, and to remove the parameter for PHP 8. And of course the documentation has to be improved; the $is_hex parameter is available as of PHP 5.5.3. [1] <https://3v4l.org/42DWp> ------------------------------------------------------------------------ [2019-09-21 12:58:09] fabien dot villepinte at gmail dot com Description: ------------ mb_decode_numericentity() expects 3 parameters but in the documentation the signature has 4 parameters. The last one should be removed. See: https://www.php.net/manual/en/function.mb-decode-numericentity.php Also when the function is called with too much parameters the warning is wrong. See the example below. Test script: --------------- <?php $r = new ReflectionFunction('mb_decode_numericentity'); var_dump($r->getNumberOfParameters()); $str = mb_decode_numericentity('', [], "UTF-8", true, 'foo'); Expected result: ---------------- int(3) Warning: mb_decode_numericentity() expects at most 3 parameters, 5 given in /in/VFjAX on line 6 Actual result: -------------- int(3) Warning: mb_decode_numericentity() expects at most 4 parameters, 5 given in /in/VFjAX on line 6 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78579&edit=1

« previous php.bugs (#222858) next »