com php-src: Added test for bug #69160 (current behavior is correct): Zend/tests/generators/yield_unary_precedence.phpt
| From: | Bob Weinand | Date: | Sat, 07 Mar 2015 19:59:42 +0000 |
| Subject: | com php-src: Added test for bug #69160 (current behavior is correct): Zend/tests/generators/yield_unary_precedence.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85306@lists.php.net to get a copy of this message | ||
Commit: b1cd381f011e2437a0ad57031ef92ede69f319b3
Author: Bob Weinand <bobwei9@hotmail.com> Sat, 7 Mar 2015 20:59:42 +0100
Parents: 95b4aa529336ede207dbd2d114521c60ec4f2ccb
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b1cd381f011e2437a0ad57031ef92ede69f319b3
Log:
Added test for bug #69160 (current behavior is correct)
Bugs:
https://bugs.php.net/69160
Changed paths:
A Zend/tests/generators/yield_unary_precedence.phpt
Diff:
diff --git a/Zend/tests/generators/yield_unary_precedence.phpt
b/Zend/tests/generators/yield_unary_precedence.phpt
new file mode 100644
index 0000000..9357168
--- /dev/null
+++ b/Zend/tests/generators/yield_unary_precedence.phpt
@@ -0,0 +1,26 @@
+--TEST--
+When + or - are used on yield, they must be unary (and not binary) (Bug #69160)
+--FILE--
+<?php
+function gen() {
+ var_dump(yield +1);
+ var_dump(yield -1);
+ var_dump(yield * -1); // other ops still should behave normally
+}
+
+for ($gen = gen(); $gen->valid(); $gen->send(1)) {
+ echo "\n";
+ var_dump($gen->current());
+}
+?>
+--EXPECT--
+
+int(1)
+int(1)
+
+int(-1)
+int(1)
+
+NULL
+int(-1)
+