]> granicus.if.org Git - php/commitdiff
...
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 21:07:29 +0000 (21:07 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 21:07:29 +0000 (21:07 +0000)
phpdbg_prompt.c
test.php

index 9ef5ecfd358a97161b8e1ee8be3e2f3b3574a1be..483835f4b96469d251412c8fbb12ab469c0d8025 100644 (file)
@@ -56,17 +56,23 @@ static inline int phpdbg_compile(TSRMLS_D) /* {{{ */
 {
        zend_file_handle fh;
 
-       printf("Attempting compilation of %s\n", PHPDBG_G(exec));
-
-       if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh,
-                   USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) {
-               PHPDBG_G(ops) = zend_compile_file(&fh, ZEND_INCLUDE TSRMLS_CC);
-               zend_destroy_file_handle(&fh TSRMLS_CC);
-               printf("Success\n");
-               return SUCCESS;
-    }
-
-       printf("Could not open file %s\n", PHPDBG_G(exec));
+       if (!EG(in_execution)) {
+           printf("Attempting compilation of %s\n", PHPDBG_G(exec));
+
+           if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh,
+                       USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) {
+                   PHPDBG_G(ops) = zend_compile_file(
+                       &fh, ZEND_INCLUDE TSRMLS_CC);
+                   zend_destroy_file_handle(&fh TSRMLS_CC);
+                   printf("Success\n");
+                   return SUCCESS;
+        } else {
+            printf("Could not open file %s\n", PHPDBG_G(exec));
+        }
+       } else {
+           printf("Cannot compile while in execution\n");
+       }
+       
        return FAILURE;
 } /* }}} */
 
@@ -77,6 +83,7 @@ static PHPDBG_COMMAND(compile) /* {{{ */
                        printf("Destroying compiled opcodes\n");
                        destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
                        efree(PHPDBG_G(ops));
+                       PHPDBG_G(ops)=NULL;
                }
 
                return phpdbg_compile(TSRMLS_C);
index d67540e1ed97e462486817259aa28a80b92d7664..a433605823bc4490dcd04013e6d9e03d8226930e 100644 (file)
--- a/test.php
+++ b/test.php
@@ -2,6 +2,9 @@
 function test() {
        echo "Hello World\n";
 }
+function test2() {
+    echo "Hello World 2\n";
+}
 if (!isset($greeting)) {
     echo test();
 }