Skip to content

Commit fbf4cec

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Fix phpGH-16727: Opcache bad signal 139 crash in ZTS bookworm (frankenphp)
2 parents f01bafc + 02ee521 commit fbf4cec

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77

88
- Core:
99
. Fail early in *nix configuration build script. (hakre)
10+
. Fixed bug GH-16727 (Opcache bad signal 139 crash in ZTS bookworm
11+
(frankenphp)). (nielsdos)
1012

1113
- FPM:
1214
. Fixed GH-16432 (PHP-FPM 8.2 SIGSEGV in fpm_get_status). (Jakub Zelenka)

Zend/zend_compile.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -8220,7 +8220,13 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
82208220
}
82218221

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

82258231
if (decl->flags & ZEND_ACC_ANON_CLASS) {
82268232
opline->opcode = ZEND_DECLARE_ANON_CLASS;

0 commit comments

Comments
 (0)