php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75799 arg of get_defined_functions is optional
Submitted: 2018-01-11 10:00 UTC Modified: 2018-01-11 12:05 UTC
From: zoeslam at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Reflection related
PHP Version: 7.2.1 OS:
Private report: No CVE-ID: None
 [2018-01-11 10:00 UTC] 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"

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-11 12:05 UTC] cmb@php.net
-Summary: ReflectionFunction on get_defined_functions reports mandatory parameters +Summary: arg of get_defined_functions is optional -Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2018-01-11 12:16 UTC] cmb@php.net
Automatic comment on behalf of carusogabriel34@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a843a86e6f21ecc497cdd3c98d9cd5feb999f357
Log: Fixed bug #75799 (arg of get_defined_functions is optional)
 [2018-01-11 12:16 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC