mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-5.5' into PHP-5.6
This commit is contained in:
commit
b3546e64bd
3 changed files with 6 additions and 0 deletions
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue