Skip to content

Commit b3546e6

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
2 parents 841dddb + 02dca18 commit b3546e6

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

Zend/tests/generators/throw_caught.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Generator::throw() where the exception is caught in the generator
44
<?php
55

66
function gen() {
7+
echo "before yield\n";
78
try {
89
yield;
910
} catch (RuntimeException $e) {
@@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('Test')));
1819

1920
?>
2021
--EXPECTF--
22+
before yield
2123
exception 'RuntimeException' with message 'Test' in %s:%d
2224
Stack trace:
2325
#0 {main}

Zend/tests/generators/throw_rethrow.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Generator::throw() where the generator throws a different exception
44
<?php
55

66
function gen() {
7+
echo "before yield\n";
78
try {
89
yield;
910
} catch (RuntimeException $e) {
@@ -18,6 +19,7 @@ var_dump($gen->throw(new RuntimeException('throw')));
1819

1920
?>
2021
--EXPECTF--
22+
before yield
2123
Caught: exception 'RuntimeException' with message 'throw' in %s:%d
2224
Stack trace:
2325
#0 {main}

Zend/zend_generators.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,8 @@ ZEND_METHOD(Generator, throw)
560560

561561
generator = (zend_generator *) zend_object_store_get_object(getThis() TSRMLS_CC);
562562

563+
zend_generator_ensure_initialized(generator TSRMLS_CC);
564+
563565
if (generator->execute_data) {
564566
/* Throw the exception in the context of the generator */
565567
zend_execute_data *current_execute_data = EG(current_execute_data);

0 commit comments

Comments
 (0)