--- /dev/null
+--TEST--
+Bug #79777: String cast exception during die should be handled gracefully
+--FILE--
+<?php
+
+die(new stdClass);
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in %s:%d
+Stack trace:
+#0 {main}
+ thrown in %s on line %d
} while (0);
FREE_OP(opline->op1_type, opline->op1.var);
}
- zend_throw_unwind_exit();
+
+ if (!EG(exception)) {
+ zend_throw_unwind_exit();
+ }
HANDLE_EXCEPTION();
}
{
/* May be NULL during generator closing (only finally blocks are executed) */
zend_object *ex = EG(exception);
- zend_bool is_unwind_exit = ex && zend_is_unwind_exit(ex);
/* Walk try/catch/finally structures upwards, performing the necessary actions */
for (; try_catch_offset != (uint32_t) -1; try_catch_offset--) {
ZEND_VM_JMP_EX(&EX(func)->op_array.opcodes[try_catch->catch_op], 0);
} else if (op_num < try_catch->finally_op) {
- if (is_unwind_exit) {
+ if (ex && zend_is_unwind_exit(ex)) {
/* Don't execute finally blocks on exit (for now) */
continue;
}