1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Remove CE cache from non-interned file cache strings

Strings loaded from the file cache can not have a CE cache, because their cache
slot is invalid. Remove the IS_STR_CLASS_NAME_MAP_PTR flag from these strings.
We can also avoid updating the str flags in SERIALIZE_STR(), since the same
updates must also be done in UNSERIALIZE_STR().

This was already done for interned strings, but not for non-interned ones.

Fixes GH-20329
Closes GH-20337
This commit is contained in:
Arnaud Le Blanc
2025-10-30 13:06:55 +01:00
parent 0584e59734
commit b062410d32
2 changed files with 6 additions and 5 deletions

4
NEWS
View File

@@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.3.29
- Opcache:
. Fixed bug GH-20329 (opcache.file_cache broken with full interned string
buffer). (Arnaud)
- Tidy:
. Fixed bug GH-20374 (PHP with tidy and custom-tags). (ndossche)

View File

@@ -134,17 +134,13 @@ static int zend_file_cache_flock(int fd, int type)
(ptr) = (void*)((char*)buf + (size_t)(ptr)); \
} \
} while (0)
#define SERIALIZE_STR(ptr) do { \
if (ptr) { \
if (IS_ACCEL_INTERNED(ptr)) { \
(ptr) = zend_file_cache_serialize_interned((zend_string*)(ptr), info); \
} else { \
ZEND_ASSERT(IS_UNSERIALIZED(ptr)); \
/* script->corrupted shows if the script in SHM or not */ \
if (EXPECTED(script->corrupted)) { \
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
} \
(ptr) = (void*)((char*)(ptr) - (char*)script->mem); \
} \
} \
@@ -163,6 +159,7 @@ static int zend_file_cache_flock(int fd, int type)
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
} \
GC_DEL_FLAGS(ptr, IS_STR_CLASS_NAME_MAP_PTR); \
} \
} \
} while (0)