php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52158 invokeArgs with args should be pass ref cause ReflectionException
Submitted: 2010-06-23 13:56 UTC Modified: 2010-10-20 04:48 UTC
From: laruence at yahoo dot com dot cn Assigned: kalle (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.2.14RC1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence at yahoo dot com dot cn
New email:
PHP Version: OS:

 

 [2010-06-23 13:56 UTC] laruence at yahoo dot com dot cn
Description:
------------
ReflectionMethod or ReflectionFunction reflects a funtion with arguments shoule be passed by reference, when invokeArgs cause invocation failed with a Exception.

I think this should been noted in php manual

more info(chinese) :http://www.laruence.com/2010/06/22/1618.html

Test script:
---------------
function who(&$name) {
    echo $name;
}
$name = "laruence";
$method = new ReflectionFunction("who");
$method->invokeArgs(array($name));


Expected result:
----------------
"laruence"

Actual result:
--------------
Uncaught exception 'ReflectionException' with message
 'Invocation of function who() failed'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-23 14:12 UTC] rquadling@php.net
As of V5.3.0, there is an E_WARNING generated ...

"Warning: Parameter 1 to who() expected to be a reference, value given".

Using ...

$method->invokeArgs(array(&$name));

is the correct way to make the call.

"NOTE : Arguments passed by reference must be supplied as references when using 
invokeArgs()."
 [2010-10-20 04:48 UTC] kalle@php.net
Automatic comment from SVN on behalf of kalle
Revision: http://svn.php.net/viewvc/?view=revision&revision=304525
Log: Properly documented the ReflectionFunction class, fixes #52158 (invokeArgs with args should be pass ref cause ReflectionException)
 [2010-10-20 04:48 UTC] kalle@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: kalle
 [2010-10-20 04:48 UTC] kalle@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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 18:01:30 2024 UTC