summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_prompt.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 24155a7860..39ef7d8768 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -1,7 +1,5 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 7 |
- +----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
@@ -124,7 +122,6 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
//???fci.symbol_table = zend_rebuild_symbol_table();
fci.object = NULL;
fci.retval = &fretval;
- fci.no_separation = 1;
if (name->next) {
zval params;
@@ -522,12 +519,7 @@ exec_code:
} /* }}} */
int phpdbg_compile_stdin(zend_string *code) {
- zval zv;
-
- ZVAL_STR(&zv, code);
-
- PHPDBG_G(ops) = zend_compile_string(&zv, "Standard input code");
-
+ PHPDBG_G(ops) = zend_compile_string(code, "Standard input code");
zend_string_release(code);
if (EG(exception)) {
@@ -723,22 +715,21 @@ static inline void phpdbg_handle_exception(void) /* {{{ */
zend_object *ex = EG(exception);
zend_string *msg, *file;
zend_long line;
- zval zv, rv, tmp;
+ zval rv, tmp;
EG(exception) = NULL;
- ZVAL_OBJ(&zv, ex);
- zend_call_method_with_0_params(&zv, ex->ce, &ex->ce->__tostring, "__tostring", &tmp);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
+ zend_call_known_instance_method_with_0_params(ex->ce->__tostring, ex, &tmp);
+ file = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("file"), 1, &rv));
+ line = zval_get_long(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("line"), 1, &rv));
if (EG(exception)) {
EG(exception) = NULL;
msg = ZSTR_EMPTY_ALLOC();
} else {
- zend_update_property_string(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), Z_STRVAL(tmp));
+ zend_update_property_string(zend_get_exception_base(ex), ex, ZEND_STRL("string"), Z_STRVAL(tmp));
zval_ptr_dtor(&tmp);
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("string"), 1, &rv));
+ msg = zval_get_string(zend_read_property(zend_get_exception_base(ex), ex, ZEND_STRL("string"), 1, &rv));
}
phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT, ZSTR_VAL(ex->ce->name), ZSTR_VAL(file), line);
@@ -1230,9 +1221,8 @@ static int add_module_info(zend_module_entry *module) /* {{{ */ {
}
/* }}} */
-static int add_zendext_info(zend_extension *ext) /* {{{ */ {
+static void add_zendext_info(zend_extension *ext) /* {{{ */ {
phpdbg_write("extension", "name=\"%s\"", "%s\n", ext->name);
- return 0;
}
/* }}} */
@@ -1668,7 +1658,6 @@ static inline void list_code() {
zend_clear_exception(); \
list_code(); \
switch (phpdbg_interactive(allow_async_unsafe, NULL)) { \
- zval zv; \
case PHPDBG_LEAVE: \
case PHPDBG_FINISH: \
case PHPDBG_UNTIL: \
@@ -1678,8 +1667,7 @@ static inline void list_code() {
EG(current_execute_data)->opline = backup_opline; \
EG(exception) = exception; \
} else { \
- Z_OBJ(zv) = exception; \
- zend_throw_exception_internal(&zv); \
+ zend_throw_exception_internal(exception); \
} \
EG(opline_before_exception) = before_ex; \
} \
@@ -1710,10 +1698,15 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
#ifdef ZEND_WIN32
if (EG(timed_out)) {
- zend_timeout(0);
+ zend_timeout();
}
#endif
+ if (exception && zend_is_unwind_exit(exception)) {
+ /* Restore bailout based exit. */
+ zend_bailout();
+ }
+
if (PHPDBG_G(flags) & PHPDBG_PREVENT_INTERACTIVE) {
phpdbg_print_opline_ex(execute_data, 0);
goto next;
@@ -1722,9 +1715,6 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
/* check for uncaught exceptions */
if (exception && PHPDBG_G(handled_exception) != exception && !(PHPDBG_G(flags) & PHPDBG_IN_EVAL)) {
zend_execute_data *prev_ex = execute_data;
- zval zv, rv;
- zend_string *file, *msg;
- zend_long line;
do {
prev_ex = zend_generator_check_placeholder_frame(prev_ex);
@@ -1740,10 +1730,10 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
PHPDBG_G(handled_exception) = exception;
- ZVAL_OBJ(&zv, exception);
- file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv));
- line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
- msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("message"), 1, &rv));
+ zval rv;
+ zend_string *file = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("file"), 1, &rv));
+ zend_long line = zval_get_long(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("line"), 1, &rv));
+ zend_string *msg = zval_get_string(zend_read_property(zend_get_exception_base(exception), exception, ZEND_STRL("message"), 1, &rv));
phpdbg_error("exception",
"name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"",