php-src/ext/reflection/tests/closures_004.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

44 lines
673 B
PHP

--TEST--
Reflection on closures: Segfault with getClosure() on closure itself
--FILE--
<?php
$closure = function() { echo "Invoked!\n"; };
$method = new ReflectionFunction ($closure);
$closure2 = $method->getClosure ();
$closure2 ();
$closure2->__invoke ();
unset ($closure);
$closure2 ();
$closure2->__invoke ();
$closure = function() { echo "Invoked!\n"; };
$method = new ReflectionMethod ($closure, '__invoke');
$closure2 = $method->getClosure ($closure);
$closure2 ();
$closure2->__invoke ();
unset ($closure);
$closure2 ();
$closure2->__invoke ();
?>
===DONE===
--EXPECT--
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
Invoked!
===DONE===