com php-src: do not destroy opcodes on resetting same context: phpdbg_prompt.c

From: Date: Sat, 23 Nov 2013 13:04:27 +0000
Subject: com php-src: do not destroy opcodes on resetting same context: phpdbg_prompt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74699@lists.php.net to get a copy of this message
Commit: fc5af4620c59027a14758bbdbbd31bbec5cb9cfd Author: krakjoe <joe.watkins@live.co.uk> Sat, 23 Nov 2013 13:04:27 +0000 Parents: 968421c145c6107ed63b6cf3f1e8e31de706b25a Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc5af4620c59027a14758bbdbbd31bbec5cb9cfd Log: do not destroy opcodes on resetting same context Changed paths: M phpdbg_prompt.c Diff: diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 3d82fbd..a4f665c 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -171,28 +171,31 @@ PHPDBG_COMMAND(exec) /* {{{ */ if (VCWD_STAT(param->str, &sb) != FAILURE) { if (sb.st_mode & (S_IFREG|S_IFLNK)) { - if (PHPDBG_G(exec)) { - phpdbg_notice("Unsetting old execution context: %s", PHPDBG_G(exec)); - efree(PHPDBG_G(exec)); - PHPDBG_G(exec) = NULL; - } - - if (PHPDBG_G(ops)) { - phpdbg_notice("Destroying compiled opcodes"); - phpdbg_clean(0 TSRMLS_CC); - } - - PHPDBG_G(exec) = phpdbg_resolve_path(param->str TSRMLS_CC); - - if (!PHPDBG_G(exec)) { - phpdbg_error("Cannot get real file path"); - return SUCCESS; - } - - PHPDBG_G(exec_len) = strlen(PHPDBG_G(exec)); + char *res = phpdbg_resolve_path(param->str TSRMLS_CC); + size_t res_len = strlen(res); + + if ((res_len != PHPDBG_G(exec_len)) || + (memcmp(res, PHPDBG_G(exec), res_len) != SUCCESS)) { + + if (PHPDBG_G(exec)) { + phpdbg_notice("Unsetting old execution context: %s", PHPDBG_G(exec)); + efree(PHPDBG_G(exec)); + PHPDBG_G(exec) = NULL; + PHPDBG_G(exec_len) = 0L; + } + + if (PHPDBG_G(ops)) { + phpdbg_notice("Destroying compiled opcodes"); + phpdbg_clean(0 TSRMLS_CC); + } - phpdbg_notice("Set execution context: %s", PHPDBG_G(exec)); + PHPDBG_G(exec) = res; + PHPDBG_G(exec_len) = res_len; + phpdbg_notice("Set execution context: %s", PHPDBG_G(exec)); + } else { + phpdbg_notice("Execution context not changed ..."); + } } else { phpdbg_error("Cannot use %s as execution context, not a valid file or symlink", param->str); }

« previous php.cvs (#74699) next »