summaryrefslogtreecommitdiffstats
path: root/174.patch
blob: 9c391bf660a41822d4ebe52d8ed9a984db09477c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
From 1c0d5b08852e1fd69ad7110f4cae53ecac26de3c Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 2 Sep 2020 09:01:23 +0200
Subject: [PATCH] fix for 8.0.0beta3

---
 ast.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/ast.c b/ast.c
index eeb6b5a..2004d7d 100644
--- a/ast.c
+++ b/ast.c
@@ -329,16 +329,15 @@ static zend_ast *get_ast(zend_string *code, zend_arena **ast_arena, char *filena
 	CG(in_compilation) = 1;
 
 	zend_save_lexical_state(&original_lex_state);
-	if (zend_prepare_string_for_scanning(&code_zv, filename) == SUCCESS) {
+	zend_prepare_string_for_scanning(&code_zv, filename);
+	CG(ast) = NULL;
+	CG(ast_arena) = zend_arena_create(1024 * 32);
+	LANG_SCNG(yy_state) = yycINITIAL;
+
+	if (zendparse() != 0) {
+		zend_ast_destroy(CG(ast));
+		zend_arena_destroy(CG(ast_arena));
 		CG(ast) = NULL;
-		CG(ast_arena) = zend_arena_create(1024 * 32);
-		LANG_SCNG(yy_state) = yycINITIAL;
-
-		if (zendparse() != 0) {
-			zend_ast_destroy(CG(ast));
-			zend_arena_destroy(CG(ast_arena));
-			CG(ast) = NULL;
-		}
 	}
 
 	/* restore_lexical_state changes CG(ast) and CG(ast_arena) */