mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
38 lines
624 B
PHP
Executable File
38 lines
624 B
PHP
Executable File
--TEST--
|
|
Catch method calls on non-objects with nested dynamic calls
|
|
--FILE--
|
|
<?php
|
|
function nested() {
|
|
throw new LogicException('Should not be called');
|
|
}
|
|
set_error_handler(function($code, $message) {
|
|
static $i= 0;
|
|
echo 'Called #'.(++$i)."\n";
|
|
});
|
|
|
|
$x= null;
|
|
|
|
$closure= function() { return nested(); };
|
|
var_dump($x->method($closure()));
|
|
|
|
$lambda= create_function('', 'return nested();');
|
|
var_dump($x->method($lambda()));
|
|
|
|
$func= 'nested';
|
|
var_dump($x->method($func()));
|
|
|
|
var_dump($x->method(call_user_func('nested')));
|
|
|
|
echo "Alive\n";
|
|
?>
|
|
--EXPECTF--
|
|
Called #1
|
|
NULL
|
|
Called #2
|
|
NULL
|
|
Called #3
|
|
NULL
|
|
Called #4
|
|
NULL
|
|
Alive
|