com php-src: Add tests for calls to nested, *non*-compile-time-resolveable functions See https://github.com/thekid/php-src/commit/a1
a4ba95117cca77b6a669d01b1cf97 ea4fcb507#commitcomment-7414362: Ze nd/tests/methods-on-non-objects-nested-calls-nonct.phpt Zen
d/tests/methods-on-non-objects-nested.inc

From: Date: Sat, 16 Aug 2014 20:03:03 +0000
Subject: com php-src: Add tests for calls to nested, *non*-compile-time-resolveable functions See https://github.com/thekid/php-src/commit/a1
a4ba95117cca77b6a669d01b1cf97 ea4fcb507#commitcomment-7414362: Ze nd/tests/methods-on-non-objects-nested-calls-nonct.phpt Zen
d/tests/methods-on-non-objects-nested.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82127@lists.php.net to get a copy of this message
Commit: 971d369d8849f9200f568b39b607417d1fc384f7 Author: Timm Friebe <thekid@thekid.de> Sat, 16 Aug 2014 22:03:03 +0200 Parents: a1a4ba95117cca77b6a669d01b1cf97ea4fcb507 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=971d369d8849f9200f568b39b607417d1fc384f7 Log: Add tests for calls to nested, *non*-compile-time-resolveable functions See https://github.com/thekid/php-src/commit/a1a4ba95117cca77b6a669d01b1cf97ea4fcb507#commitcomment-7414362 Changed paths: A Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt A Zend/tests/methods-on-non-objects-nested.inc Diff: diff --git a/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt new file mode 100755 index 0000000..a4529ee --- /dev/null +++ b/Zend/tests/methods-on-non-objects-nested-calls-nonct.phpt @@ -0,0 +1,43 @@ +--TEST-- +Catch method calls on non-objects with nested non-compile-time-resolveable calls +--FILE-- +<?php +require('methods-on-non-objects-nested.inc'); + +set_error_handler(function($code, $message) { + static $i= 0; + echo 'Called #'.(++$i)."\n"; +}); + +$x= null; + +var_dump($x->method(nested())); + +$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'))); +var_dump($x->method(call_user_func_array('nested', []))); + +echo "Alive\n"; +?> +--EXPECTF-- +Called #1 +NULL +Called #2 +NULL +Called #3 +NULL +Called #4 +NULL +Called #5 +NULL +Called #6 +NULL +Alive diff --git a/Zend/tests/methods-on-non-objects-nested.inc b/Zend/tests/methods-on-non-objects-nested.inc new file mode 100755 index 0000000..8511414 --- /dev/null +++ b/Zend/tests/methods-on-non-objects-nested.inc @@ -0,0 +1,4 @@ +<?php +function nested() { + throw new LogicException('Should not be called'); +} \ No newline at end of file

« previous php.cvs (#82127) next »