Skip to content

Commit 4c8091e

Browse files
TysonAndrenikic
authored andcommitted
Fix a php 7.4-dev segfault
The change to add typed properties accesses cache_slot[2] (of `AST_CACHE_SLOT_*`). This fixes that.
1 parent b1f4c4c commit 4c8091e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ast.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
#define ast_register_flag_constant(name, value) \
2424
REGISTER_NS_LONG_CONSTANT("ast\\flags", name, value, CONST_CS | CONST_PERSISTENT)
2525

26-
#define AST_CACHE_SLOT_KIND &AST_G(cache_slots)[2 * 0]
27-
#define AST_CACHE_SLOT_FLAGS &AST_G(cache_slots)[2 * 1]
28-
#define AST_CACHE_SLOT_LINENO &AST_G(cache_slots)[2 * 2]
29-
#define AST_CACHE_SLOT_CHILDREN &AST_G(cache_slots)[2 * 3]
26+
#define AST_CACHE_SLOT_KIND &AST_G(cache_slots)[3 * 0]
27+
#define AST_CACHE_SLOT_FLAGS &AST_G(cache_slots)[3 * 1]
28+
#define AST_CACHE_SLOT_LINENO &AST_G(cache_slots)[3 * 2]
29+
#define AST_CACHE_SLOT_CHILDREN &AST_G(cache_slots)[3 * 3]
3030

3131
#define AST_CURRENT_VERSION 60
3232

php_ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern zend_module_entry ast_module_entry;
2121
#include "TSRM.h"
2222
#endif
2323

24-
#define AST_NUM_CACHE_SLOTS (2 * 4)
24+
#define AST_NUM_CACHE_SLOTS (3 * 4)
2525

2626
ZEND_BEGIN_MODULE_GLOBALS(ast)
2727
void *cache_slots[AST_NUM_CACHE_SLOTS];

0 commit comments

Comments
 (0)