com php-src: Ensure not evaluated twice: tests/lang/operators/coalesce.phpt

From: Date: Tue, 16 Sep 2014 18:32:01 +0000
Subject: com php-src: Ensure not evaluated twice: tests/lang/operators/coalesce.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81990@lists.php.net to get a copy of this message
Commit: 157da54e8236f939ed79fa9f91a2c9f4dd08fc68 Author: Andrea Faulds <ajf@ajf.me> Tue, 16 Sep 2014 19:32:01 +0100 Parents: a1711cee1714d9cc4c4a2f18b3a45f195e5a2adf Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=157da54e8236f939ed79fa9f91a2c9f4dd08fc68 Log: Ensure not evaluated twice Changed paths: M tests/lang/operators/coalesce.phpt Diff: diff --git a/tests/lang/operators/coalesce.phpt b/tests/lang/operators/coalesce.phpt index 30571d4..327a11a 100644 --- a/tests/lang/operators/coalesce.phpt +++ b/tests/lang/operators/coalesce.phpt @@ -19,6 +19,11 @@ $arr = [ ] ]; +function foobar() { + echo "called\n"; + return ['a']; +} + var_dump($nonexistant_variable ?? 3); echo PHP_EOL; var_dump($var ?? 3); @@ -35,6 +40,8 @@ var_dump($arr["foobar"] ?? 3); var_dump($arr["qux"] ?? 3); var_dump($arr["bing"][0] ?? 3); var_dump($arr["bing"][1] ?? 3); +echo PHP_EOL; +var_dump(foobar()[0] ?? false); ?> --EXPECTF-- int(3) @@ -55,4 +62,7 @@ object(stdClass)#%d (%d) { int(7) } string(4) "bang" -int(3) \ No newline at end of file +int(3) + +called +string(1) "a" \ No newline at end of file

« previous php.cvs (#81990) next »