summaryrefslogtreecommitdiff
path: root/Zend/tests/generators
diff options
context:
space:
mode:
authorLior Kaplan <kaplanlior@gmail.com>2014-01-11 13:43:40 +0200
committerLior Kaplan <kaplanlior@gmail.com>2014-01-11 13:43:40 +0200
commit650fb41a77b3a24ab4130b05fff243b64b241877 (patch)
treeb64f1cfd733f03ce1db807733ddf87ac8d62a903 /Zend/tests/generators
parent5a58c4dae727fbc8bd92770c2708baf9e7688857 (diff)
downloadphp-650fb41a77b3a24ab4130b05fff243b64b241877.tar.gz
Imported Upstream version 5.5.8+dfsgupstream/5.5.8+dfsg
Diffstat (limited to 'Zend/tests/generators')
-rw-r--r--Zend/tests/generators/bug66041.phpt17
-rw-r--r--Zend/tests/generators/throw_caught.phpt2
-rw-r--r--Zend/tests/generators/throw_rethrow.phpt2
3 files changed, 21 insertions, 0 deletions
diff --git a/Zend/tests/generators/bug66041.phpt b/Zend/tests/generators/bug66041.phpt
new file mode 100644
index 000000000..d94422413
--- /dev/null
+++ b/Zend/tests/generators/bug66041.phpt
@@ -0,0 +1,17 @@
+--TEST--
+Bug #66041: list() fails to unpack yielded ArrayAccess object
+--FILE--
+<?php
+function dumpElement() {
+ list($value) = yield;
+ var_dump($value);
+};
+
+$fixedArray = new SplFixedArray(1);
+$fixedArray[0] = 'the element';
+
+$generator = dumpElement();
+$generator->send($fixedArray);
+?>
+--EXPECT--
+string(11) "the element"
diff --git a/Zend/tests/generators/throw_caught.phpt b/Zend/tests/generators/throw_caught.phpt
index 0c3f8e9b2..c5e9d81eb 100644
--- a/Zend/tests/generators/throw_caught.phpt
+++ b/Zend/tests/generators/throw_caught.phpt
@@ -4,6 +4,7 @@ Generator::throw() where the exception is caught in the generator
<?php
function gen() {
+ echo "before yield\n";
try {
yield;
} catch (RuntimeException $e) {
@@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('Test')));
?>
--EXPECTF--
+before yield
exception 'RuntimeException' with message 'Test' in %s:%d
Stack trace:
#0 {main}
diff --git a/Zend/tests/generators/throw_rethrow.phpt b/Zend/tests/generators/throw_rethrow.phpt
index 267f5f0db..65044ee3f 100644
--- a/Zend/tests/generators/throw_rethrow.phpt
+++ b/Zend/tests/generators/throw_rethrow.phpt
@@ -4,6 +4,7 @@ Generator::throw() where the generator throws a different exception
<?php
function gen() {
+ echo "before yield\n";
try {
yield;
} catch (RuntimeException $e) {
@@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('throw')));
?>
--EXPECTF--
+before yield
Caught: exception 'RuntimeException' with message 'throw' in %s:%d
Stack trace:
#0 {main}