Skip to content

Commit f8c1ce1

Browse files
committed
Revert "Merge branch 'PHP-7.1' into PHP-7.2"
This reverts commit c547c1b, reversing changes made to 4c083e7.
1 parent c547c1b commit f8c1ce1

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

NEWS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ PHP NEWS
1010
(mgorny)
1111

1212
- Opcache:
13-
. Fixed bug #76205 (PHP-FPM sporadic crash when running Infinitewp).
14-
(Dmitry)
1513
. Fixed bug #76275 (Assertion failure in file cache when unserializing empty
1614
try_catch_array). (Nikita)
1715
. Fixed bug #76281 (Opcache causes incorrect "undefined variable" errors).

ext/opcache/zend_file_cache.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ static int zend_file_cache_flock(int fd, int type)
101101
#define IS_SERIALIZED(ptr) \
102102
((char*)(ptr) <= (char*)script->size)
103103
#define IS_UNSERIALIZED(ptr) \
104-
((char*)(ptr) >= (char*)script->mem && (char*)(ptr) < (char*)script->mem + script->size)
104+
(((char*)(ptr) >= (char*)script->mem && (char*)(ptr) < (char*)script->mem + script->size) || \
105+
IS_ACCEL_INTERNED(ptr))
105106
#define SERIALIZE_PTR(ptr) do { \
106107
if (ptr) { \
107-
ZEND_ASSERT(IS_UNSERIALIZED(ptr) || IS_ACCEL_INTERNED(ptr)); \
108+
ZEND_ASSERT(IS_UNSERIALIZED(ptr)); \
108109
(ptr) = (void*)((char*)(ptr) - (char*)script->mem); \
109110
} \
110111
} while (0)
@@ -960,12 +961,12 @@ static void zend_file_cache_unserialize_zval(zval *zv,
960961
switch (Z_TYPE_P(zv)) {
961962
case IS_STRING:
962963
case IS_CONSTANT:
963-
if (IS_SERIALIZED(Z_STR_P(zv))) {
964+
if (!IS_UNSERIALIZED(Z_STR_P(zv))) {
964965
UNSERIALIZE_STR(Z_STR_P(zv));
965966
}
966967
break;
967968
case IS_ARRAY:
968-
if (IS_SERIALIZED(Z_ARR_P(zv))) {
969+
if (!IS_UNSERIALIZED(Z_ARR_P(zv))) {
969970
HashTable *ht;
970971

971972
UNSERIALIZE_PTR(Z_ARR_P(zv));
@@ -975,7 +976,7 @@ static void zend_file_cache_unserialize_zval(zval *zv,
975976
}
976977
break;
977978
case IS_REFERENCE:
978-
if (IS_SERIALIZED(Z_REF_P(zv))) {
979+
if (!IS_UNSERIALIZED(Z_REF_P(zv))) {
979980
zend_reference *ref;
980981

981982
UNSERIALIZE_PTR(Z_REF_P(zv));
@@ -984,12 +985,12 @@ static void zend_file_cache_unserialize_zval(zval *zv,
984985
}
985986
break;
986987
case IS_CONSTANT_AST:
987-
if (IS_SERIALIZED(Z_AST_P(zv))) {
988+
if (!IS_UNSERIALIZED(Z_AST_P(zv))) {
988989
zend_ast_ref *ast;
989990

990991
UNSERIALIZE_PTR(Z_AST_P(zv));
991992
ast = Z_AST_P(zv);
992-
if (IS_SERIALIZED(ast->ast)) {
993+
if (!IS_UNSERIALIZED(ast->ast)) {
993994
ast->ast = zend_file_cache_unserialize_ast(ast->ast, script, buf);
994995
}
995996
}
@@ -1001,7 +1002,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10011002
zend_persistent_script *script,
10021003
void *buf)
10031004
{
1004-
if (op_array->static_variables && IS_SERIALIZED(op_array->static_variables)) {
1005+
if (op_array->static_variables && !IS_UNSERIALIZED(op_array->static_variables)) {
10051006
HashTable *ht;
10061007

10071008
UNSERIALIZE_PTR(op_array->static_variables);
@@ -1026,7 +1027,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10261027
return;
10271028
}
10281029

1029-
if (op_array->literals && IS_SERIALIZED(op_array->literals)) {
1030+
if (op_array->literals && !IS_UNSERIALIZED(op_array->literals)) {
10301031
zval *p, *end;
10311032

10321033
UNSERIALIZE_PTR(op_array->literals);
@@ -1038,7 +1039,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10381039
}
10391040
}
10401041

1041-
if (IS_SERIALIZED(op_array->opcodes)) {
1042+
if (!IS_UNSERIALIZED(op_array->opcodes)) {
10421043
zend_op *opline, *end;
10431044

10441045
UNSERIALIZE_PTR(op_array->opcodes);
@@ -1099,7 +1100,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10991100
end++;
11001101
}
11011102
while (p < end) {
1102-
if (IS_SERIALIZED(p->name)) {
1103+
if (!IS_UNSERIALIZED(p->name)) {
11031104
UNSERIALIZE_STR(p->name);
11041105
}
11051106
if (p->type & (Z_UL(1) << (sizeof(zend_type)*8-1))) { /* type is class */
@@ -1120,7 +1121,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
11201121
p = op_array->vars;
11211122
end = p + op_array->last_var;
11221123
while (p < end) {
1123-
if (IS_SERIALIZED(*p)) {
1124+
if (!IS_UNSERIALIZED(*p)) {
11241125
UNSERIALIZE_STR(*p);
11251126
}
11261127
p++;
@@ -1152,19 +1153,19 @@ static void zend_file_cache_unserialize_prop_info(zval *zv,
11521153
zend_persistent_script *script,
11531154
void *buf)
11541155
{
1155-
if (IS_SERIALIZED(Z_PTR_P(zv))) {
1156+
if (!IS_UNSERIALIZED(Z_PTR_P(zv))) {
11561157
zend_property_info *prop;
11571158

11581159
UNSERIALIZE_PTR(Z_PTR_P(zv));
11591160
prop = Z_PTR_P(zv);
11601161

1161-
if (prop->ce && IS_SERIALIZED(prop->ce)) {
1162+
if (prop->ce && !IS_UNSERIALIZED(prop->ce)) {
11621163
UNSERIALIZE_PTR(prop->ce);
11631164
}
1164-
if (prop->name && IS_SERIALIZED(prop->name)) {
1165+
if (prop->name && !IS_UNSERIALIZED(prop->name)) {
11651166
UNSERIALIZE_STR(prop->name);
11661167
}
1167-
if (prop->doc_comment && IS_SERIALIZED(prop->doc_comment)) {
1168+
if (prop->doc_comment && !IS_UNSERIALIZED(prop->doc_comment)) {
11681169
UNSERIALIZE_STR(prop->doc_comment);
11691170
}
11701171
}
@@ -1174,17 +1175,17 @@ static void zend_file_cache_unserialize_class_constant(zval *
11741175
zend_persistent_script *script,
11751176
void *buf)
11761177
{
1177-
if (IS_SERIALIZED(Z_PTR_P(zv))) {
1178+
if (!IS_UNSERIALIZED(Z_PTR_P(zv))) {
11781179
zend_class_constant *c;
11791180

11801181
UNSERIALIZE_PTR(Z_PTR_P(zv));
11811182
c = Z_PTR_P(zv);
11821183

11831184
zend_file_cache_unserialize_zval(&c->value, script, buf);
1184-
if (c->ce && IS_SERIALIZED(c->ce)) {
1185+
if (c->ce && !IS_UNSERIALIZED(c->ce)) {
11851186
UNSERIALIZE_PTR(c->ce);
11861187
}
1187-
if (c->doc_comment && IS_SERIALIZED(c->doc_comment)) {
1188+
if (c->doc_comment && !IS_UNSERIALIZED(c->doc_comment)) {
11881189
UNSERIALIZE_STR(c->doc_comment);
11891190
}
11901191
}

0 commit comments

Comments
 (0)