mirror of
https://github.com/php/php-src.git
synced 2026-04-19 22:11:12 +02:00
Merge branch 'PHP-5.5'
This commit is contained in:
20
Zend/tests/generators/bug65035.phpt
Normal file
20
Zend/tests/generators/bug65035.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #65035: yield / exit segfault
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function gen() {
|
||||
fn();
|
||||
yield;
|
||||
}
|
||||
|
||||
function fn() {
|
||||
exit('Done');
|
||||
}
|
||||
|
||||
$gen = gen();
|
||||
$gen->current();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
Done
|
||||
20
Zend/tests/generators/bug65161.phpt
Normal file
20
Zend/tests/generators/bug65161.phpt
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #65161: Generator + autoload + syntax error = segfault
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function autoload() {
|
||||
foo();
|
||||
}
|
||||
spl_autoload_register('autoload');
|
||||
|
||||
function testGenerator() {
|
||||
new SyntaxError('param');
|
||||
yield;
|
||||
}
|
||||
|
||||
foreach (testGenerator() as $i);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Call to undefined function foo() in %s on line %d
|
||||
@@ -55,6 +55,12 @@ ZEND_API void zend_generator_close(zend_generator *generator, zend_bool finished
|
||||
zval_ptr_dtor(&execute_data->current_this);
|
||||
}
|
||||
|
||||
/* A fatal error / die occured during the generator execution. Trying to clean
|
||||
* up the stack may not be safe in this case. */
|
||||
if (CG(unclean_shutdown)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the generator is closed before it can finish execution (reach
|
||||
* a return statement) we have to free loop variables manually, as
|
||||
* we don't know whether the SWITCH_FREE / FREE opcodes have run */
|
||||
|
||||
Reference in New Issue
Block a user