Bug #75799 [Opn->Ver]: arg of get_defined_functions is optional
Edit report at https://bugs.php.net/bug.php?id=75799&edit=1
ID: 75799
Updated by: cmb@php.net
Reported by: zoeslam at gmail dot com
-Summary: ReflectionFunction on get_defined_functions reports
mandatory parameters
+Summary: arg of get_defined_functions is optional
-Status: Open
+Status: Verified
Type: Bug
Package: Reflection related
PHP Version: 7.2.1
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2018-01-11 10:00:56] zoeslam at gmail dot com
Description:
------------
get_defined_functions has 1 optinal parameter.
ReflectionFunction instead reports it as mandatory.
https://3v4l.org/pRaFj
Bug present since 7.1.10
Possible commit that introduced the bug:
https://github.com/php/php-src/commit/58aa726548b18c4a48dd9804063b4eb8845aa7ef
Test script:
---------------
<?php
$refFunc = new \ReflectionFunction('get_defined_functions');
var_dump($refFunc->getNumberOfRequiredParameters());
foreach ($refFunc->getParameters() as $parameter) {
var_dump(sprintf('Parameter: "%s"; optional: %s', $parameter->name,
var_export($parameter->isOptional(), true)));
}
Expected result:
----------------
int(0)
string(46) "Parameter: "exclude_disabled"; optional: true"
Actual result:
--------------
int(1)
string(46) "Parameter: "exclude_disabled"; optional: false"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75799&edit=1
Thread (3 messages)