note 98013 modified in reflectionmethod.invokeargs by danbrown

From: Date: Thu, 20 May 2010 15:41:16 +0000
Subject: note 98013 modified in reflectionmethod.invokeargs by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-169452@lists.php.net to get a copy of this message
it seems that ReflectionMethod::invodeArgs() dont like reference-arguments in the method to call: <?php class Test{ function foo(&$arg){ $arg++; } } $test = new Test(); $class = new ReflectionClass("Test"); $method = $class->getMethod("foo"); $bar = 9; $method->invokeArgs($test, array($bar)); ?> RESULT: "Invocation of method Test::foo() failed" --was-- it seems that ReflectionMethod::invodeArgs() dont like reference-arguments in the method to call: <?php class Test{ function foo(&$arg){ $arg++; } } $test = new Test(); $class = new ReflectionClass("Test"); $method = $class->getMethod("foo"); $bar = 9; $method->invokeArgs($test, array($bar)); # RESULT: "Invocation of method Test::foo() failed" http://php.net/manual/en/reflectionmethod.invokeargs.php

« previous php.notes (#169452) next »