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.
This commit is contained in:
Nikita Popov 2021-08-18 10:55:17 +02:00
parent 8f1a217a1f
commit de7ba3e737

View File

@ -1140,7 +1140,9 @@ static void zend_file_cache_unserialize_zval(zval *zv,
{
switch (Z_TYPE_P(zv)) {
case IS_STRING:
if (!IS_UNSERIALIZED(Z_STR_P(zv))) {
/* We can't use !IS_UNSERIALIZED here, because that does not recognize unserialized
* interned strings in non-shm mode. */
if (IS_SERIALIZED(Z_STR_P(zv)) || IS_SERIALIZED_INTERNED(Z_STR_P(zv))) {
UNSERIALIZE_STR(Z_STR_P(zv));
}
break;