Skip to content

Commit 7f090ac

Browse files
committed
Merge branch 'PHP-7.1' of https://git.php.net/push/php-src into PHP-7.1
2 parents 643c9c9 + df4d0a7 commit 7f090ac

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

NEWS

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

99
- Opcache:
10-
. Fixed bug #76205 (PHP-FPM sporadic crash when running Infinitewp).
11-
(Dmitry)
1210
. Fixed bug #76275 (Assertion failure in file cache when unserializing empty
1311
try_catch_array). (Nikita)
1412
. Fixed bug #76281 (Opcache causes incorrect "undefined variable" errors).

ext/opcache/zend_file_cache.c

Lines changed: 21 additions & 20 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)
@@ -951,12 +952,12 @@ static void zend_file_cache_unserialize_zval(zval *zv,
951952
switch (Z_TYPE_P(zv)) {
952953
case IS_STRING:
953954
case IS_CONSTANT:
954-
if (IS_SERIALIZED(Z_STR_P(zv))) {
955+
if (!IS_UNSERIALIZED(Z_STR_P(zv))) {
955956
UNSERIALIZE_STR(Z_STR_P(zv));
956957
}
957958
break;
958959
case IS_ARRAY:
959-
if (IS_SERIALIZED(Z_ARR_P(zv))) {
960+
if (!IS_UNSERIALIZED(Z_ARR_P(zv))) {
960961
HashTable *ht;
961962

962963
UNSERIALIZE_PTR(Z_ARR_P(zv));
@@ -966,7 +967,7 @@ static void zend_file_cache_unserialize_zval(zval *zv,
966967
}
967968
break;
968969
case IS_REFERENCE:
969-
if (IS_SERIALIZED(Z_REF_P(zv))) {
970+
if (!IS_UNSERIALIZED(Z_REF_P(zv))) {
970971
zend_reference *ref;
971972

972973
UNSERIALIZE_PTR(Z_REF_P(zv));
@@ -975,12 +976,12 @@ static void zend_file_cache_unserialize_zval(zval *zv,
975976
}
976977
break;
977978
case IS_CONSTANT_AST:
978-
if (IS_SERIALIZED(Z_AST_P(zv))) {
979+
if (!IS_UNSERIALIZED(Z_AST_P(zv))) {
979980
zend_ast_ref *ast;
980981

981982
UNSERIALIZE_PTR(Z_AST_P(zv));
982983
ast = Z_AST_P(zv);
983-
if (IS_SERIALIZED(ast->ast)) {
984+
if (!IS_UNSERIALIZED(ast->ast)) {
984985
ast->ast = zend_file_cache_unserialize_ast(ast->ast, script, buf);
985986
}
986987
}
@@ -992,7 +993,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
992993
zend_persistent_script *script,
993994
void *buf)
994995
{
995-
if (op_array->static_variables && IS_SERIALIZED(op_array->static_variables)) {
996+
if (op_array->static_variables && !IS_UNSERIALIZED(op_array->static_variables)) {
996997
HashTable *ht;
997998

998999
UNSERIALIZE_PTR(op_array->static_variables);
@@ -1017,7 +1018,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10171018
return;
10181019
}
10191020

1020-
if (op_array->literals && IS_SERIALIZED(op_array->literals)) {
1021+
if (op_array->literals && !IS_UNSERIALIZED(op_array->literals)) {
10211022
zval *p, *end;
10221023

10231024
UNSERIALIZE_PTR(op_array->literals);
@@ -1029,7 +1030,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10291030
}
10301031
}
10311032

1032-
if (IS_SERIALIZED(op_array->opcodes)) {
1033+
if (!IS_UNSERIALIZED(op_array->opcodes)) {
10331034
zend_op *opline, *end;
10341035

10351036
UNSERIALIZE_PTR(op_array->opcodes);
@@ -1088,10 +1089,10 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
10881089
end++;
10891090
}
10901091
while (p < end) {
1091-
if (IS_SERIALIZED(p->name)) {
1092+
if (!IS_UNSERIALIZED(p->name)) {
10921093
UNSERIALIZE_STR(p->name);
10931094
}
1094-
if (IS_SERIALIZED(p->class_name)) {
1095+
if (!IS_UNSERIALIZED(p->class_name)) {
10951096
UNSERIALIZE_STR(p->class_name);
10961097
}
10971098
p++;
@@ -1105,7 +1106,7 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
11051106
p = op_array->vars;
11061107
end = p + op_array->last_var;
11071108
while (p < end) {
1108-
if (IS_SERIALIZED(*p)) {
1109+
if (!IS_UNSERIALIZED(*p)) {
11091110
UNSERIALIZE_STR(*p);
11101111
}
11111112
p++;
@@ -1137,19 +1138,19 @@ static void zend_file_cache_unserialize_prop_info(zval *zv,
11371138
zend_persistent_script *script,
11381139
void *buf)
11391140
{
1140-
if (IS_SERIALIZED(Z_PTR_P(zv))) {
1141+
if (!IS_UNSERIALIZED(Z_PTR_P(zv))) {
11411142
zend_property_info *prop;
11421143

11431144
UNSERIALIZE_PTR(Z_PTR_P(zv));
11441145
prop = Z_PTR_P(zv);
11451146

1146-
if (prop->ce && IS_SERIALIZED(prop->ce)) {
1147+
if (prop->ce && !IS_UNSERIALIZED(prop->ce)) {
11471148
UNSERIALIZE_PTR(prop->ce);
11481149
}
1149-
if (prop->name && IS_SERIALIZED(prop->name)) {
1150+
if (prop->name && !IS_UNSERIALIZED(prop->name)) {
11501151
UNSERIALIZE_STR(prop->name);
11511152
}
1152-
if (prop->doc_comment && IS_SERIALIZED(prop->doc_comment)) {
1153+
if (prop->doc_comment && !IS_UNSERIALIZED(prop->doc_comment)) {
11531154
UNSERIALIZE_STR(prop->doc_comment);
11541155
}
11551156
}
@@ -1159,17 +1160,17 @@ static void zend_file_cache_unserialize_class_constant(zval *
11591160
zend_persistent_script *script,
11601161
void *buf)
11611162
{
1162-
if (IS_SERIALIZED(Z_PTR_P(zv))) {
1163+
if (!IS_UNSERIALIZED(Z_PTR_P(zv))) {
11631164
zend_class_constant *c;
11641165

11651166
UNSERIALIZE_PTR(Z_PTR_P(zv));
11661167
c = Z_PTR_P(zv);
11671168

11681169
zend_file_cache_unserialize_zval(&c->value, script, buf);
1169-
if (c->ce && IS_SERIALIZED(c->ce)) {
1170+
if (c->ce && !IS_UNSERIALIZED(c->ce)) {
11701171
UNSERIALIZE_PTR(c->ce);
11711172
}
1172-
if (c->doc_comment && IS_SERIALIZED(c->doc_comment)) {
1173+
if (c->doc_comment && !IS_UNSERIALIZED(c->doc_comment)) {
11731174
UNSERIALIZE_STR(c->doc_comment);
11741175
}
11751176
}

0 commit comments

Comments
 (0)