Skip to content

Commit 7d794c0

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Intern string values of internal classes to prevent their future interning during inheritance.
2 parents 3ba7756 + bda449a commit 7d794c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,15 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
710710
} ZEND_HASH_FOREACH_END();
711711

712712
ZEND_HASH_MAP_FOREACH_BUCKET(&ce->constants_table, q) {
713+
zend_class_constant* c;
714+
713715
if (q->key) {
714716
q->key = new_interned_string(q->key);
715717
}
718+
c = (zend_class_constant*)Z_PTR(q->val);
719+
if (Z_TYPE(c->value) == IS_STRING) {
720+
ZVAL_STR(&c->value, new_interned_string(Z_STR(c->value)));
721+
}
716722
} ZEND_HASH_FOREACH_END();
717723
} ZEND_HASH_FOREACH_END();
718724

0 commit comments

Comments
 (0)