Skip to content

Commit 65585b3

Browse files
committed
Fixed compiler reenterability
1 parent 5a1d2fe commit 65585b3

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Zend/zend_compile.c

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ ZEND_API void file_handle_dtor(zend_file_handle *fh) /* {{{ */
219219
void init_compiler(TSRMLS_D) /* {{{ */
220220
{
221221
CG(active_op_array) = NULL;
222+
memset(&CG(context), 0, sizeof(CG(context)));
222223
zend_init_compiler_data_structures(TSRMLS_C);
223224
zend_init_rsrc_list(TSRMLS_C);
224225
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);

Zend/zend_language_scanner.l

+2
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ ZEND_API zend_op_array *compile_file(zend_file_handle *file_handle, int type TSR
578578
init_op_array(op_array, ZEND_USER_FUNCTION, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
579579
CG(in_compilation) = 1;
580580
CG(active_op_array) = op_array;
581+
zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
581582
zend_init_compiler_context(TSRMLS_C);
582583
compiler_result = zendparse(TSRMLS_C);
583584
zend_do_return(&retval_znode, 0 TSRMLS_CC);
@@ -747,6 +748,7 @@ zend_op_array *compile_string(zval *source_string, char *filename TSRMLS_DC)
747748
init_op_array(op_array, ZEND_EVAL_CODE, INITIAL_OP_ARRAY_SIZE TSRMLS_CC);
748749
CG(interactive) = orig_interactive;
749750
CG(active_op_array) = op_array;
751+
zend_stack_push(&CG(context_stack), (void *) &CG(context), sizeof(CG(context)));
750752
zend_init_compiler_context(TSRMLS_C);
751753
BEGIN(ST_IN_SCRIPTING);
752754
compiler_result = zendparse(TSRMLS_C);

0 commit comments

Comments
 (0)