Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8043,7 +8043,13 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
}

opline->op1_type = IS_CONST;
LITERAL_STR(opline->op1, lcname);
/* It's possible that `lcname` is not an interned string because it was not yet in the interned string table.
* However, by this point another thread may have caused `lcname` to be added in the interned string table.
* This will cause `lcname` to get freed once it is found in the interned string table. If we were to use
* LITERAL_STR() here we would not change the `lcname` pointer to the new value, and it would point to the
* now-freed string. This will cause issues when we use `lcname` in the code below. We solve this by using
* zend_add_literal_string() which gives us the new value. */
opline->op1.constant = zend_add_literal_string(&lcname);

if (decl->flags & ZEND_ACC_ANON_CLASS) {
opline->opcode = ZEND_DECLARE_ANON_CLASS;
Expand Down
Loading