note 98013 modified in reflectionmethod.invokeargs by danbrown

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.