Bug #78579 [Opn->Ver]: mb_decode_numericentity: args number inconsistency
| From: | cmb@php.net | Date: | Sat, 21 Sep 2019 13:19:49 +0000 |
| Subject: | Bug #78579 [Opn->Ver]: mb_decode_numericentity: args number inconsistency | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222856@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: Open
+Status: Verified
Type: Bug
Package: mbstring related
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[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