Do not run finally blocks in generators on unclean shutdown (e.g.
caused by exit). This is consistent with how finally blocks outside
of generators behave.
. Fixed bug #75786 (segfault when using spread operator on generator passed
by reference). (Nikita)
. Fixed bug #75799 (arg of get_defined_functions is optional). (carusogabriel)
+ . Fixed bug #75396 (Exit inside generator finally results in fatal error).
+ (Nikita)
- Opcache:
. Fixed bug #75720 (File cache not populated after SHM runs full). (Dmitry)
--- /dev/null
+--TEST--
+Bug #75396: Exit inside generator finally results in fatal error
+--FILE--
+<?php
+
+$gen = (function () {
+ yield 42;
+
+ try {
+ echo "Try\n";
+ exit("Exit\n");
+ } finally {
+ echo "Finally\n";
+ }
+})();
+
+$gen->send("x");
+
+?>
+--EXPECT--
+Try
+Exit
generator->node.parent = NULL;
}
- if (EXPECTED(!ex) || EXPECTED(!(ex->func->op_array.fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK))) {
+ if (EXPECTED(!ex) || EXPECTED(!(ex->func->op_array.fn_flags & ZEND_ACC_HAS_FINALLY_BLOCK))
+ || CG(unclean_shutdown)) {
return;
}