Skip to content

Commit b062410

Browse files
committed
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
1 parent 0584e59 commit b062410

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 8.3.29
44

5+
- Opcache:
6+
. Fixed bug GH-20329 (opcache.file_cache broken with full interned string
7+
buffer). (Arnaud)
8+
59
- Tidy:
610
. Fixed bug GH-20374 (PHP with tidy and custom-tags). (ndossche)
711

ext/opcache/zend_file_cache.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,13 @@ static int zend_file_cache_flock(int fd, int type)
134134
(ptr) = (void*)((char*)buf + (size_t)(ptr)); \
135135
} \
136136
} while (0)
137+
137138
#define SERIALIZE_STR(ptr) do { \
138139
if (ptr) { \
139140
if (IS_ACCEL_INTERNED(ptr)) { \
140141
(ptr) = zend_file_cache_serialize_interned((zend_string*)(ptr), info); \
141142
} else { \
142143
ZEND_ASSERT(IS_UNSERIALIZED(ptr)); \
143-
/* script->corrupted shows if the script in SHM or not */ \
144-
if (EXPECTED(script->corrupted)) { \
145-
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
146-
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
147-
} \
148144
(ptr) = (void*)((char*)(ptr) - (char*)script->mem); \
149145
} \
150146
} \
@@ -163,6 +159,7 @@ static int zend_file_cache_flock(int fd, int type)
163159
GC_ADD_FLAGS(ptr, IS_STR_INTERNED); \
164160
GC_DEL_FLAGS(ptr, IS_STR_PERMANENT); \
165161
} \
162+
GC_DEL_FLAGS(ptr, IS_STR_CLASS_NAME_MAP_PTR); \
166163
} \
167164
} \
168165
} while (0)

0 commit comments

Comments
 (0)