Skip to content

Commit dfba04e

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix phpGH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)
2 parents 234219d + 382be92 commit dfba04e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Zend/zend_compile.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9163,7 +9163,13 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
91639163
}
91649164

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

91689174
if (decl->flags & ZEND_ACC_ANON_CLASS) {
91699175
opline->opcode = ZEND_DECLARE_ANON_CLASS;

0 commit comments

Comments
 (0)