summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2012-11-14 17:45:10 +0400
committerDmitry Stogov <dmitry@zend.com>2012-11-14 17:45:10 +0400
commit65585b3aa2cbba0e7227877ce8b7c8bf78d98a38 (patch)
tree028132f0282f3e51d9cc4f4c78a1361919a687bd
parent5a1d2fe415cbd21f2237629b956012565494f203 (diff)
downloadphp-git-65585b3aa2cbba0e7227877ce8b7c8bf78d98a38.tar.gz
Fixed compiler reenterability
-rw-r--r--Zend/zend_compile.c1
-rw-r--r--Zend/zend_language_scanner.l2
2 files changed, 3 insertions, 0 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 4dd3eaf1ed..f25e7fac6d 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -219,6 +219,7 @@ ZEND_API void file_handle_dtor(zend_file_handle *fh) /* {{{ */
void init_compiler(TSRMLS_D) /* {{{ */
{
CG(active_op_array) = NULL;
+ memset(&CG(context), 0, sizeof(CG(context)));
zend_init_compiler_data_structures(TSRMLS_C);
zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
diff --git a/Zend/zend_language_scanner.l b/Zend/zend_language_scanner.l
index 703ca968ea..bb35a9339c 100644
--- a/Zend/zend_language_scanner.l
+++ b/Zend/zend_language_scanner.l
@@ -578,6 +578,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
CG(in_compilation) = 1;
CG(active_op_array) = op_array;
+ zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
zend_init_compiler_context(TSRMLS_C);
compiler_result = zendparse(TSRMLS_C);
zend_do_return(&retval_znode, 0 TSRMLS_CC);
@@ -747,6 +748,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
CG(interactive) = orig_interactive;
CG(active_op_array) = op_array;
+ zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
zend_init_compiler_context(TSRMLS_C);
BEGIN(ST_IN_SCRIPTING);
compiler_result = zendparse(TSRMLS_C);