Skip to content

Commit 44944ac

Browse files
remicolletnikic
authored andcommitted
fix for 8.0.0beta3
1 parent f0f8c3b commit 44944ac

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

ast.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,15 @@ static zend_ast *get_ast(zend_string *code, zend_arena **ast_arena, char *filena
329329
CG(in_compilation) = 1;
330330

331331
zend_save_lexical_state(&original_lex_state);
332-
if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) {
332+
zend_prepare_string_for_scanning(&code_zv, filename);
333+
CG(ast) = NULL;
334+
CG(ast_arena) = zend_arena_create(1024 * 32);
335+
LANG_SCNG(yy_state) = yycINITIAL;
336+
337+
if (zendparse() != 0) {
338+
zend_ast_destroy(CG(ast));
339+
zend_arena_destroy(CG(ast_arena));
333340
CG(ast) = NULL;
334-
CG(ast_arena) = zend_arena_create(1024 * 32);
335-
LANG_SCNG(yy_state) = yycINITIAL;
336-
337-
if (zendparse() != 0) {
338-
zend_ast_destroy(CG(ast));
339-
zend_arena_destroy(CG(ast_arena));
340-
CG(ast) = NULL;
341-
}
342341
}
343342

344343
/* restore_lexical_state changes CG(ast) and CG(ast_arena) */

0 commit comments

Comments
 (0)