Bug #75799 [Opn->Ver]: arg of get_defined_functions is optional

From: Date: Thu, 11 Jan 2018 12:05:30 +0000
Subject: Bug #75799 [Opn->Ver]: arg of get_defined_functions is optional
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213472@lists.php.net to get a copy of this message
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)

« previous php.bugs (#213472) next »