From 5b3e1ded356dc877aa246d28e71e69286b8829b5 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Thu, 3 May 2018 12:10:33 +0300 Subject: Fixed bug #76205 (PHP-FPM sporadic crash when running Infinitewp) --- NEWS | 1 + ext/opcache/zend_file_cache.c | 48 +++++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index 02a9367008..bdcc11b75b 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ PHP NEWS (mgorny) - Opcache: + . Fixed bug #76205 (PHP-FPM sporadic crash when running Infinitewp). (Dmitry) . Fixed bug #76275 (Assertion failure in file cache when unserializing empty try_catch_array). (Nikita) . Fixed bug #76281 (Opcache causes incorrect "undefined variable" errors). diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 23f2f9d0cb..c66e5aeeca 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -526,14 +526,13 @@ static void zend_file_cache_serialize_prop_info(zval *zv, prop = Z_PTR_P(zv); UNSERIALIZE_PTR(prop); - if (prop->ce && !IS_SERIALIZED(prop->ce)) { + ZEND_ASSERT(prop->ce != NULL && prop->name != NULL); + if (!IS_SERIALIZED(prop->ce)) { SERIALIZE_PTR(prop->ce); - } - if (prop->name && !IS_SERIALIZED(prop->name)) { SERIALIZE_STR(prop->name); - } - if (prop->doc_comment && !IS_SERIALIZED(prop->doc_comment)) { - SERIALIZE_STR(prop->doc_comment); + if (prop->doc_comment) { + SERIALIZE_STR(prop->doc_comment); + } } } } @@ -550,12 +549,15 @@ static void zend_file_cache_serialize_class_constant(zval *z c = Z_PTR_P(zv); UNSERIALIZE_PTR(c); - zend_file_cache_serialize_zval(&c->value, script, info, buf); - if (c->ce && !IS_SERIALIZED(c->ce)) { + ZEND_ASSERT(c->ce != NULL); + if (!IS_SERIALIZED(c->ce)) { SERIALIZE_PTR(c->ce); - } - if (c->doc_comment && !IS_SERIALIZED(c->doc_comment)) { - SERIALIZE_STR(c->doc_comment); + + zend_file_cache_serialize_zval(&c->value, script, info, buf); + + if (c->doc_comment) { + SERIALIZE_STR(c->doc_comment); + } } } } @@ -1144,14 +1146,13 @@ static void zend_file_cache_unserialize_prop_info(zval *zv, UNSERIALIZE_PTR(Z_PTR_P(zv)); prop = Z_PTR_P(zv); - if (prop->ce && !IS_UNSERIALIZED(prop->ce)) { + ZEND_ASSERT(prop->ce != NULL && prop->name != NULL); + if (!IS_UNSERIALIZED(prop->ce)) { UNSERIALIZE_PTR(prop->ce); - } - if (prop->name && !IS_UNSERIALIZED(prop->name)) { UNSERIALIZE_STR(prop->name); - } - if (prop->doc_comment && !IS_UNSERIALIZED(prop->doc_comment)) { - UNSERIALIZE_STR(prop->doc_comment); + if (prop->doc_comment) { + UNSERIALIZE_STR(prop->doc_comment); + } } } } @@ -1166,12 +1167,15 @@ static void zend_file_cache_unserialize_class_constant(zval * UNSERIALIZE_PTR(Z_PTR_P(zv)); c = Z_PTR_P(zv); - zend_file_cache_unserialize_zval(&c->value, script, buf); - if (c->ce && !IS_UNSERIALIZED(c->ce)) { + ZEND_ASSERT(c->ce != NULL); + if (!IS_UNSERIALIZED(c->ce)) { UNSERIALIZE_PTR(c->ce); - } - if (c->doc_comment && !IS_UNSERIALIZED(c->doc_comment)) { - UNSERIALIZE_STR(c->doc_comment); + + zend_file_cache_unserialize_zval(&c->value, script, buf); + + if (c->doc_comment) { + UNSERIALIZE_STR(c->doc_comment); + } } } } -- cgit v1.2.1