Bug #75799 [NEW]: ReflectionFunction on get_defined_functions reports mandatory parameters
From: zoeslam at gmail dot com
Operating system:
PHP version: 7.2.1
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionFunction on get_defined_functions reports mandatory parameters
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 bug report at https://bugs.php.net/bug.php?id=75799&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75799&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75799&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75799&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75799&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75799&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75799&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75799&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75799&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75799&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75799&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75799&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75799&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75799&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75799&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75799&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75799&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75799&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75799&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75799&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75799&r=mysqlcfg
Thread (3 messages)
- zoeslam at gmail dot com