php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78579 mb_decode_numericentity: args number inconsistency
Submitted: 2019-09-21 12:58 UTC Modified: 2019-09-21 14:41 UTC
From: fabien dot villepinte at gmail dot com Assigned: cmb (profile)
Status: Closed Package: mbstring related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2019-09-21 12:58 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-21 13:19 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2019-09-21 13:19 UTC] 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 14:18 UTC] 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 14:18 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2019-09-21 14:41 UTC] cmb@php.net
> the $is_hex parameter is available as of PHP 5.5.3.

Correction: it is available as of PHP 5.4.0.
 [2019-09-21 14:46 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=348030
Log: Fix #78579: mb_decode_numericentity: args number inconsistency
 [2019-09-21 14:50 UTC] salathe@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=7ac3a31dd868cd2f622f92be59a8a92babee9a76
Log: Fix #78579: mb_decode_numericentity: args number inconsistency
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 22:01:29 2019 UTC