<?php
class foo
{
public function bar($a)
{
echo $a;
}
}
class not_foo
{
public function bar($a)
{
echo "not $a";
}
}
$r = new ReflectionClass('foo');
$m = $r->getMethod('bar');
$m->invoke(new not_foo, 'baz');
Fatal error: Uncaught ReflectionException: Given object is not an instance of the class this method was declared in in /in/sCFcA:21
Stack trace:
#0 /in/sCFcA(21): ReflectionMethod->invoke(Object(not_foo), 'baz')
#1 {main}
thrown in /in/sCFcA on line 21
Process exited with code 255.
Output for 5.6.0 - 5.6.25
Fatal error: Uncaught exception 'ReflectionException' with message 'Given object is not an instance of the class this method was declared in' in /in/sCFcA:21
Stack trace:
#0 /in/sCFcA(21): ReflectionMethod->invoke(Object(not_foo), 'baz')
#1 {main}
thrown in /in/sCFcA on line 21
Process exited with code 255.