php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49631 Documentation of ReflectionFunctionAbstract::getParameters return value
Submitted: 2009-09-22 18:52 UTC Modified: 2009-10-02 20:47 UTC
From: julien_picalausa at yahoo dot fr Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2009-09-22 18:52 UTC] julien_picalausa at yahoo dot fr
Description:
------------
The documentation of ReflectionFunctionAbstract::getParameters indicates that the return value is "The parameters, as a ReflectionParameter object.". Of course, since a ReflectionParameter object is just reflecting one single parameter, it cannot return all of them as a single of those objects.
Testing reveals that ReflectionFunctionAbstract::getParameters returns an _array_ of ReflectionParameter objects (more or less as expected).

I tested this on php 5.2.9, but whether or not this behavior has changed in newer versions shouldn't matter as the documentation would still be incorrect.

Reproduce code:
---------------
class Test
{
        public function AFunction($x, $y, $z)
        {
                $this->AnotherFunction($z, $x, $y);
        }
}


$r = new ReflectionMethod('Test', 'Afunction');
$p = $r->getParameters();
var_dump($p);

Actual result:
--------------
array(3) {
  [0]=>
  &object(ReflectionParameter)#2 (1) {
    ["name"]=>
    string(1) "x"
  }
  [1]=>
  &object(ReflectionParameter)#3 (1) {
    ["name"]=>
    string(1) "y"
  }
  [2]=>
  &object(ReflectionParameter)#4 (1) {
    ["name"]=>
    string(1) "z"
  }

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-02 20:46 UTC] svn@php.net
Automatic comment from SVN on behalf of fa
Revision: http://svn.php.net/viewvc/?view=revision&revision=289098
Log: changed return value from ReflectionParameter to array  - fix #49631
 [2009-10-02 20:47 UTC] fa@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:10 UTC] phpdocbot@php.net
Automatic comment on behalf of fa
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=ce8e8ecf30e9b2301facee25568e376a1d12d4c6
Log: changed return value from ReflectionParameter to array  - fix #49631
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 13:00:02 2026 UTC