1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 16:38:25 +02:00

Merge branch 'PHP-8.1'

* PHP-8.1:
  Don't populate CE_CACHE during compilation
This commit is contained in:
Nikita Popov
2021-10-04 15:38:15 +02:00
2 changed files with 5 additions and 4 deletions
+5 -1
View File
@@ -1101,7 +1101,10 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
}
return NULL;
}
if (ZSTR_HAS_CE_CACHE(name)) {
/* Don't populate CE_CACHE for mutable classes during compilation.
* The class may be freed while persisting. */
if (ZSTR_HAS_CE_CACHE(name) &&
(!CG(in_compilation) || (ce->ce_flags & ZEND_ACC_IMMUTABLE))) {
ZSTR_SET_CE_CACHE(name, ce);
}
return ce;
@@ -1157,6 +1160,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
zend_string_release_ex(lc_name, 0);
}
if (ce) {
ZEND_ASSERT(!CG(in_compilation));
if (ZSTR_HAS_CE_CACHE(name)) {
ZSTR_SET_CE_CACHE(name, ce);
}
-3
View File
@@ -868,9 +868,6 @@ zend_class_entry *zend_persist_class_entry(zend_class_entry *orig_ce)
ce->inheritance_cache = NULL;
if (!(ce->ce_flags & ZEND_ACC_CACHED)) {
if (ZSTR_HAS_CE_CACHE(ce->name)) {
ZSTR_SET_CE_CACHE(ce->name, NULL);
}
zend_accel_store_interned_string(ce->name);
if (!(ce->ce_flags & ZEND_ACC_ANON_CLASS)
&& !ZCG(current_persistent_script)->corrupted) {