2008-08-11 22:31:22 +00:00
|
|
|
--TEST--
|
|
|
|
Reflection on closures: Segfaults with getParameters() and getDeclaringFunction()
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
$closure = function($a, $b = 0) { };
|
|
|
|
|
2009-01-26 22:54:34 +00:00
|
|
|
$method = new ReflectionMethod ($closure, '__invoke');
|
2008-08-11 22:31:22 +00:00
|
|
|
$params = $method->getParameters ();
|
|
|
|
unset ($method);
|
|
|
|
$method = $params[0]->getDeclaringFunction ();
|
|
|
|
unset ($params);
|
|
|
|
echo $method->getName ()."\n";
|
|
|
|
|
2009-01-26 22:54:34 +00:00
|
|
|
$parameter = new ReflectionParameter (array ($closure, '__invoke'), 'b');
|
2008-08-11 22:31:22 +00:00
|
|
|
$method = $parameter->getDeclaringFunction ();
|
|
|
|
unset ($parameter);
|
|
|
|
echo $method->getName ()."\n";
|
|
|
|
|
|
|
|
?>
|
|
|
|
===DONE===
|
|
|
|
--EXPECTF--
|
|
|
|
__invoke
|
|
|
|
__invoke
|
|
|
|
===DONE===
|