From: krakjoe Date: Sun, 10 Nov 2013 21:07:29 +0000 (+0000) Subject: ... X-Git-Tag: php-5.6.0alpha1~110^2~512 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6203c96061501091ba6851fca655c5c02252581d;p=php ... --- diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 9ef5ecfd35..483835f4b9 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -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); diff --git a/test.php b/test.php index d67540e1ed..a433605823 100644 --- 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(); }