diff options
author | Ilija Tovilo <ilija.tovilo@me.com> | 2020-06-10 23:10:18 +0200 |
---|---|---|
committer | Ilija Tovilo <ilija.tovilo@me.com> | 2021-03-17 19:08:03 +0100 |
commit | 269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7 (patch) | |
tree | 810ac41b2157ff4e8063f9696f97e1a9d77837c4 /ext/opcache/zend_file_cache.c | |
parent | a6fc427b8c51015c16541c112a26dd06bd75e99e (diff) | |
download | php-git-269c8dac1d56ee85d71ae94d9b28dd7d8e8de7b7.tar.gz |
Implement enums
RFC: https://wiki.php.net/rfc/enumerations
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Closes GH-6489.
Diffstat (limited to 'ext/opcache/zend_file_cache.c')
-rw-r--r-- | ext/opcache/zend_file_cache.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 4c7611d36d..884ee796e0 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -637,12 +637,12 @@ static void zend_file_cache_serialize_func(zval *zv, zend_file_cache_metainfo *info, void *buf) { - zend_op_array *op_array; - + zend_function *func; SERIALIZE_PTR(Z_PTR_P(zv)); - op_array = Z_PTR_P(zv); - UNSERIALIZE_PTR(op_array); - zend_file_cache_serialize_op_array(op_array, script, info, buf); + func = Z_PTR_P(zv); + UNSERIALIZE_PTR(func); + ZEND_ASSERT(func->type == ZEND_USER_FUNCTION); + zend_file_cache_serialize_op_array(&func->op_array, script, info, buf); } static void zend_file_cache_serialize_prop_info(zval *zv, @@ -844,6 +844,14 @@ static void zend_file_cache_serialize_class(zval *zv, } } + if (ce->backed_enum_table) { + HashTable *ht; + SERIALIZE_PTR(ce->backed_enum_table); + ht = ce->backed_enum_table; + UNSERIALIZE_PTR(ht); + zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval); + } + SERIALIZE_PTR(ce->constructor); SERIALIZE_PTR(ce->destructor); SERIALIZE_PTR(ce->clone); @@ -1432,11 +1440,11 @@ static void zend_file_cache_unserialize_func(zval *zv, zend_persistent_script *script, void *buf) { - zend_op_array *op_array; - + zend_function *func; UNSERIALIZE_PTR(Z_PTR_P(zv)); - op_array = Z_PTR_P(zv); - zend_file_cache_unserialize_op_array(op_array, script, buf); + func = Z_PTR_P(zv); + ZEND_ASSERT(func->type == ZEND_USER_FUNCTION); + zend_file_cache_unserialize_op_array(&func->op_array, script, buf); } static void zend_file_cache_unserialize_prop_info(zval *zv, @@ -1615,6 +1623,12 @@ static void zend_file_cache_unserialize_class(zval *zv, } } + if (ce->backed_enum_table) { + UNSERIALIZE_PTR(ce->backed_enum_table); + zend_file_cache_unserialize_hash( + ce->backed_enum_table, script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR); + } + UNSERIALIZE_PTR(ce->constructor); UNSERIALIZE_PTR(ce->destructor); UNSERIALIZE_PTR(ce->clone); |