com php-src: Verify non-CV-operands also work See discussion https://github.com/php/php-src/pull/647#issuecomment-48050551:
Zend/tests/methods-on-non-objects-dynamic.phpt

From: Date: Sun, 06 Jul 2014 10:55:27 +0000
Subject: com php-src: Verify non-CV-operands also work See discussion https://github.com/php/php-src/pull/647#issuecomment-48050551:
Zend/tests/methods-on-non-objects-dynamic.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-82142@lists.php.net to get a copy of this message
Commit: e0cf63f4be775bace6d947c0cc1be9f0512ecdd5 Author: Timm Friebe <thekid@thekid.de> Sun, 6 Jul 2014 12:55:27 +0200 Parents: dc68aa32bc33afcf9c42494c6db498f7c47c93e9 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e0cf63f4be775bace6d947c0cc1be9f0512ecdd5 Log: Verify non-CV-operands also work See discussion https://github.com/php/php-src/pull/647#issuecomment-48050551 Changed paths: A Zend/tests/methods-on-non-objects-dynamic.phpt Diff: diff --git a/Zend/tests/methods-on-non-objects-dynamic.phpt b/Zend/tests/methods-on-non-objects-dynamic.phpt new file mode 100755 index 0000000..11c5c9f --- /dev/null +++ b/Zend/tests/methods-on-non-objects-dynamic.phpt @@ -0,0 +1,23 @@ +--TEST-- +Catch method calls on non-objects with dynamic lookups +--FILE-- +<?php +set_error_handler(function($code, $message) { + static $i= 0; + echo 'Called #'.(++$i)."\n"; +}); + +$arr= [null, 'method']; +var_dump($arr[0]->{$arr[1]}()); + +$fun= function() { return null; }; +var_dump($fun()->{'method'}()); + +echo "Alive\n"; +?> +--EXPECTF-- +Called #1 +NULL +Called #2 +NULL +Alive

« previous php.cvs (#82142) next »