Skip to content

Commit 8902128

Browse files
committed
Fix uncaught exception in phpdbg
1 parent 5f35e57 commit 8902128

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

sapi/phpdbg/phpdbg_prompt.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,21 @@ static inline void phpdbg_handle_exception(void) /* }}} */
575575

576576
zval_ptr_dtor(&trace);
577577
} else {
578-
phpdbg_error("exception", "name=\"%s\"" "Uncaught %s!", EG(exception)->ce->name->val);
578+
phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!", EG(exception)->ce->name->val);
579579
}
580580

581581
/* output useful information about address */
582-
phpdbg_writeln("exception", "opline=\"%p\" file=\"%s\" line=\"%u\"", "Stack entered at %p in %s on line %u", EG(current_execute_data)->func->op_array.opcodes, filename, lineno);
582+
/* not really useful ???
583+
phpdbg_writeln("exception", "opline=\"%p\" file=\"%s\" line=\"%u\"", "Stack entered at %p in %s on line %u", PHPDBG_G(ops)->opcodes, filename, lineno); */
583584

584585
zval_dtor(&fci.function_name);
585-
zend_clear_exception();
586+
if (EG(prev_exception)) {
587+
OBJ_RELEASE(EG(prev_exception));
588+
EG(prev_exception) = 0;
589+
}
590+
OBJ_RELEASE(EG(exception));
591+
EG(exception) = NULL;
592+
EG(opline_before_exception) = NULL;
586593
} /* }}} */
587594

588595
PHPDBG_COMMAND(run) /* {{{ */

0 commit comments

Comments
 (0)