Bug #52158 [Opn->Csd]: invokeArgs with args should be pass ref cause ReflectionException

From: Date: Wed, 20 Oct 2010 02:48:58 +0000
Subject: Bug #52158 [Opn->Csd]: invokeArgs with args should be pass ref cause ReflectionException
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5261@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52158&edit=1 ID: 52158 Updated by: kalle@php.net Reported by: laruence at yahoo dot com dot cn Summary: invokeArgs with args should be pass ref cause ReflectionException -Status: Open +Status: Closed Type: Bug Package: Documentation problem PHP Version: 5.2.14RC1 -Assigned To: +Assigned To: kalle Block user comment: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2010-10-20 04:48:23] 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-06-23 14:12:05] 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-06-23 13:56:58] 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' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52158&edit=1

« previous php.doc.bugs (#5261) next »