mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix static property indirections in file cache
If the class is already linked, we need to serialize and unserialize INDIRECTed static properties. Normally these would be set up when copying from cache.
This commit is contained in:
parent
8819d247c6
commit
db0cdcbb0a
1 changed files with 15 additions and 18 deletions
|
@ -368,6 +368,10 @@ static void zend_file_cache_serialize_zval(zval *zv,
|
|||
zend_file_cache_serialize_ast(GC_AST(ast), script, info, buf);
|
||||
}
|
||||
break;
|
||||
case IS_INDIRECT:
|
||||
/* Used by static properties. */
|
||||
SERIALIZE_PTR(Z_INDIRECT_P(zv));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,7 +630,6 @@ static void zend_file_cache_serialize_class(zval *zv,
|
|||
void *buf)
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
zend_class_entry *parent = NULL;
|
||||
|
||||
SERIALIZE_PTR(Z_PTR_P(zv));
|
||||
ce = Z_PTR_P(zv);
|
||||
|
@ -637,7 +640,6 @@ static void zend_file_cache_serialize_class(zval *zv,
|
|||
if (!(ce->ce_flags & ZEND_ACC_LINKED)) {
|
||||
SERIALIZE_STR(ce->parent_name);
|
||||
} else {
|
||||
parent = ce->parent;
|
||||
SERIALIZE_PTR(ce->parent);
|
||||
}
|
||||
}
|
||||
|
@ -655,16 +657,13 @@ static void zend_file_cache_serialize_class(zval *zv,
|
|||
}
|
||||
}
|
||||
if (ce->default_static_members_table) {
|
||||
zval *table, *p, *end;
|
||||
zval *p, *end;
|
||||
|
||||
SERIALIZE_PTR(ce->default_static_members_table);
|
||||
table = ce->default_static_members_table;
|
||||
UNSERIALIZE_PTR(table);
|
||||
p = ce->default_static_members_table;
|
||||
UNSERIALIZE_PTR(p);
|
||||
|
||||
/* Serialize only static properties in this class.
|
||||
* Static properties from parent classes will be handled in class_copy_ctor */
|
||||
p = table + (parent ? parent->default_static_members_count : 0);
|
||||
end = table + ce->default_static_members_count;
|
||||
end = p + ce->default_static_members_count;
|
||||
while (p < end) {
|
||||
zend_file_cache_serialize_zval(p, script, info, buf);
|
||||
p++;
|
||||
|
@ -1081,6 +1080,10 @@ static void zend_file_cache_unserialize_zval(zval *zv,
|
|||
zend_file_cache_unserialize_ast(Z_ASTVAL_P(zv), script, buf);
|
||||
}
|
||||
break;
|
||||
case IS_INDIRECT:
|
||||
/* Used by static properties. */
|
||||
UNSERIALIZE_PTR(Z_INDIRECT_P(zv));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1325,7 +1328,6 @@ static void zend_file_cache_unserialize_class(zval *zv,
|
|||
void *buf)
|
||||
{
|
||||
zend_class_entry *ce;
|
||||
zend_class_entry *parent = NULL;
|
||||
|
||||
UNSERIALIZE_PTR(Z_PTR_P(zv));
|
||||
ce = Z_PTR_P(zv);
|
||||
|
@ -1336,7 +1338,6 @@ static void zend_file_cache_unserialize_class(zval *zv,
|
|||
UNSERIALIZE_STR(ce->parent_name);
|
||||
} else {
|
||||
UNSERIALIZE_PTR(ce->parent);
|
||||
parent = ce->parent;
|
||||
}
|
||||
}
|
||||
zend_file_cache_unserialize_hash(&ce->function_table,
|
||||
|
@ -1353,14 +1354,10 @@ static void zend_file_cache_unserialize_class(zval *zv,
|
|||
}
|
||||
}
|
||||
if (ce->default_static_members_table) {
|
||||
zval *table, *p, *end;
|
||||
|
||||
/* Unserialize only static properties in this class.
|
||||
* Static properties from parent classes will be handled in class_copy_ctor */
|
||||
zval *p, *end;
|
||||
UNSERIALIZE_PTR(ce->default_static_members_table);
|
||||
table = ce->default_static_members_table;
|
||||
p = table + (parent ? parent->default_static_members_count : 0);
|
||||
end = table + ce->default_static_members_count;
|
||||
p = ce->default_static_members_table;
|
||||
end = p + ce->default_static_members_count;
|
||||
while (p < end) {
|
||||
zend_file_cache_unserialize_zval(p, script, buf);
|
||||
p++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue