summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg_prompt.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-07-27 11:17:23 +0800
committerXinchen Hui <laruence@php.net>2015-07-27 11:17:23 +0800
commit9f56cfa9a18c3684306af501436c1bbcd1621820 (patch)
tree58357417459e87208d04a3299ed94e0ba6c4a3ed /sapi/phpdbg/phpdbg_prompt.c
parent6aeee47b2cd47915ccfa3b41433a3f57aea24dd5 (diff)
parent70c6a6f624ec07be37ce90424d0765e3c78d1bf5 (diff)
downloadphp-git-9f56cfa9a18c3684306af501436c1bbcd1621820.tar.gz
Merge branch 'master' of git.php.net:php-src
Diffstat (limited to 'sapi/phpdbg/phpdbg_prompt.c')
-rw-r--r--sapi/phpdbg/phpdbg_prompt.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c
index 5ad3fea79d..9d40d000c2 100644
--- a/sapi/phpdbg/phpdbg_prompt.c
+++ b/sapi/phpdbg/phpdbg_prompt.c
@@ -418,12 +418,13 @@ PHPDBG_COMMAND(exec) /* {{{ */
VCWD_CHDIR_FILE(res);
*SG(request_info).argv = PHPDBG_G(exec);
- php_hash_environment();
+ php_build_argv(NULL, &PG(http_globals)[TRACK_VARS_SERVER]);
phpdbg_notice("exec", "type=\"set\" context=\"%s\"", "Set execution context: %s", PHPDBG_G(exec));
if (PHPDBG_G(in_execution)) {
phpdbg_clean(1);
+ return SUCCESS;
}
phpdbg_compile();
@@ -678,7 +679,7 @@ PHPDBG_COMMAND(run) /* {{{ */
SG(request_info).argv = erealloc(argv, ++argc * sizeof(char *));
SG(request_info).argc = argc;
- php_hash_environment();
+ php_build_argv(NULL, &PG(http_globals)[TRACK_VARS_SERVER]);
}
zend_try {
@@ -689,13 +690,10 @@ PHPDBG_COMMAND(run) /* {{{ */
} zend_catch {
PHPDBG_G(in_execution) = 0;
- if (PHPDBG_G(flags) & PHPDBG_IS_QUITTING) {
- zend_bailout();
- }
-
if (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
- phpdbg_error("stop", "type=\"bailout\"", "Caught exit/error from VM");
restore = 0;
+ } else {
+ zend_bailout();
}
} zend_end_try();
@@ -708,11 +706,13 @@ PHPDBG_COMMAND(run) /* {{{ */
if (EG(exception)) {
phpdbg_handle_exception();
}
- }
- phpdbg_clean(1);
+ PHPDBG_G(in_execution) = 1;
+ }
PHPDBG_G(flags) &= ~PHPDBG_IS_RUNNING;
+
+ phpdbg_clean(1);
} else {
phpdbg_error("inactive", "type=\"nocontext\"", "Nothing to execute!");
}
@@ -744,6 +744,7 @@ PHPDBG_COMMAND(ev) /* {{{ */
zend_execute_data *original_execute_data = EG(current_execute_data);
zend_class_entry *original_scope = EG(scope);
zend_vm_stack original_stack = EG(vm_stack);
+ zend_object *ex = NULL;
PHPDBG_OUTPUT_BACKUP();
@@ -769,6 +770,7 @@ PHPDBG_COMMAND(ev) /* {{{ */
zend_try {
if (zend_eval_stringl(param->str, param->len, &retval, "eval()'d code") == SUCCESS) {
if (EG(exception)) {
+ ex = EG(exception);
zend_exception_error(EG(exception), E_ERROR);
} else {
phpdbg_xml("<eval %r>");
@@ -783,11 +785,16 @@ PHPDBG_COMMAND(ev) /* {{{ */
}
}
} zend_catch {
+ PHPDBG_G(unclean_eval) = 1;
+ if (ex) {
+ OBJ_RELEASE(ex);
+ }
EG(current_execute_data) = original_execute_data;
EG(scope) = original_scope;
EG(vm_stack_top) = original_stack->top;
EG(vm_stack_end) = original_stack->end;
EG(vm_stack) = original_stack;
+ EG(exit_status) = 0;
} zend_end_try();
PHPDBG_G(flags) &= ~PHPDBG_IN_EVAL;
@@ -1185,14 +1192,10 @@ PHPDBG_COMMAND(register) /* {{{ */
PHPDBG_COMMAND(quit) /* {{{ */
{
- /* don't allow this to loop, ever ... */
- if (!(PHPDBG_G(flags) & PHPDBG_IS_STOPPING)) {
- PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
- PHPDBG_G(flags) &= ~(PHPDBG_IS_RUNNING | PHPDBG_IS_CLEANING);
- zend_bailout();
- }
+ PHPDBG_G(flags) |= PHPDBG_IS_QUITTING;
+ PHPDBG_G(flags) &= ~PHPDBG_IS_CLEANING;
- return PHPDBG_NEXT;
+ return SUCCESS;
} /* }}} */
PHPDBG_COMMAND(clean) /* {{{ */
@@ -1211,8 +1214,6 @@ PHPDBG_COMMAND(clean) /* {{{ */
phpdbg_writeln("clean", "constants=\"%d\"", "Constants %d", zend_hash_num_elements(EG(zend_constants)));
phpdbg_writeln("clean", "includes=\"%d\"", "Includes %d", zend_hash_num_elements(&EG(included_files)));
- PHPDBG_G(flags) &= ~PHPDBG_IS_RUNNING;
-
phpdbg_clean(1);
phpdbg_xml("</cleaninfo>");
@@ -1291,7 +1292,7 @@ int phpdbg_interactive(zend_bool allow_async_unsafe) /* {{{ */
PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE;
while (ret == SUCCESS || ret == FAILURE) {
- if ((PHPDBG_G(flags) & (PHPDBG_IS_STOPPING | PHPDBG_IS_RUNNING)) == PHPDBG_IS_STOPPING) {
+ if (PHPDBG_G(flags) & PHPDBG_IS_STOPPING) {
zend_bailout();
}
@@ -1370,15 +1371,14 @@ void phpdbg_clean(zend_bool full) /* {{{ */
{
/* this is implicitly required */
if (PHPDBG_G(ops)) {
- destroy_op_array(PHPDBG_G(ops));
- efree(PHPDBG_G(ops));
+ if (destroy_op_array(PHPDBG_G(ops))) {
+ efree(PHPDBG_G(ops));
+ }
PHPDBG_G(ops) = NULL;
}
if (full) {
PHPDBG_G(flags) |= PHPDBG_IS_CLEANING;
-
- zend_bailout();
}
} /* }}} */