Skip to content

Commit de7ba3e

Browse files
committed
Fix repeated file cache unserialization of zval string
The IS_UNSERIALIZED check here does not work if the string is interned (serialized with file_cache_only=0) but unserialization happens with file_cache_only=1. In this case the unserializde string will be in the str area after mem, which is not included in the script size, and which is also not accessible at this point without threading through more information. Work around the problem by checking for the serialized representation instead.
1 parent 8f1a217 commit de7ba3e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/opcache/zend_file_cache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,9 @@ static void zend_file_cache_unserialize_zval(zval *zv,
11401140
{
11411141
switch (Z_TYPE_P(zv)) {
11421142
case IS_STRING:
1143-
if (!IS_UNSERIALIZED(Z_STR_P(zv))) {
1143+
/* We can't use !IS_UNSERIALIZED here, because that does not recognize unserialized
1144+
* interned strings in non-shm mode. */
1145+
if (IS_SERIALIZED(Z_STR_P(zv)) || IS_SERIALIZED_INTERNED(Z_STR_P(zv))) {
11441146
UNSERIALIZE_STR(Z_STR_P(zv));
11451147
}
11461148
break;

0 commit comments

Comments
 (0)