Skip to content

Commit 382be92

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)
2 parents e789183 + fbf4cec commit 382be92

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
@@ -9146,7 +9146,13 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
91469146
}
91479147

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

91519157
if (decl->flags & ZEND_ACC_ANON_CLASS) {
91529158
opline->opcode = ZEND_DECLARE_ANON_CLASS;

0 commit comments

Comments
 (0)