summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2013-12-01 13:45:22 +0100
committerNikita Popov <nikic@php.net>2013-12-01 13:45:22 +0100
commitb3546e64bd872d2fcbd9634c59b103cecfa023a0 (patch)
tree8664616670d093224ac36f243086844662213a44 /Zend
parent841dddb3c25dc1a7ff2a274136eccc919447a0bf (diff)
parent02dca18b9045029e75d672b8667c1411dde5ca34 (diff)
downloadphp-git-b3546e64bd872d2fcbd9634c59b103cecfa023a0.tar.gz
Merge branch 'PHP-5.5' into PHP-5.6
Diffstat (limited to 'Zend')
-rw-r--r--Zend/tests/generators/throw_caught.phpt2
-rw-r--r--Zend/tests/generators/throw_rethrow.phpt2
-rw-r--r--Zend/zend_generators.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/Zend/tests/generators/throw_caught.phpt b/Zend/tests/generators/throw_caught.phpt
index 0c3f8e9b2d..c5e9d81ebc 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 267f5f0db8..65044ee3f3 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}
diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c
index aca15c2a88..e121e3c92a 100644
--- a/Zend/zend_generators.c
+++ b/Zend/zend_generators.c
@@ -560,6 +560,8 @@ ZEND_METHOD(Generator, throw)
generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
+ zend_generator_ensure_initialized(generator TSRMLS_CC);
+
if (generator->execute_data) {
/* Throw the exception in the context of the generator */
zend_execute_data *current_execute_data = EG(current_execute_data);