]> granicus.if.org Git - php/commitdiff
do not destroy opcodes on resetting same context
authorkrakjoe <joe.watkins@live.co.uk>
Sat, 23 Nov 2013 13:04:27 +0000 (13:04 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sat, 23 Nov 2013 13:04:27 +0000 (13:04 +0000)
phpdbg_prompt.c

index 3d82fbde3a77ee64979ac770f6393d59f3bd3f7d..a4f665c61e9fccf8f0a197dda28e59c371542dd5 100644 (file)
@@ -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);
                                }