com php-src: Check for name vs ce in a few more places: ext/opcache/zend_persist.c ext/opcache/zend_persist_c alc.c
| From: | Nikita Popov | Date: | Tue, 14 Jul 2020 12:47:47 +0000 |
| Subject: | com php-src: Check for name vs ce in a few more places: ext/opcache/zend_persist.c ext/opcache/zend_persist_c alc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112168@lists.php.net to get a copy of this message | ||
Commit: 7e6b2e2e2324b7a2bba3da1ad3ae4837a1052262
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 14 Jul 2020 14:44:35 +0200
Parents: 7c16d11e3cef9280fcfc35484ad7fcd8240ee4ec
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e6b2e2e2324b7a2bba3da1ad3ae4837a1052262
Log:
Check for name vs ce in a few more places
The type lists may contain CEs, we should not assume they only
contain names.
Changed paths:
M ext/opcache/zend_persist.c
M ext/opcache/zend_persist_calc.c
Diff:
diff --git a/ext/opcache/zend_persist.c b/ext/opcache/zend_persist.c
index e6b5194bfe..b37504c4b0 100644
--- a/ext/opcache/zend_persist.c
+++ b/ext/opcache/zend_persist.c
@@ -294,7 +294,6 @@ static HashTable *zend_persist_attributes(HashTable *attributes)
static void zend_persist_type(zend_type *type) {
if (ZEND_TYPE_HAS_LIST(*type)) {
- zend_type *list_type;
zend_type_list *list = ZEND_TYPE_LIST(*type);
if (ZEND_TYPE_USES_ARENA(*type)) {
if (!ZCG(is_immutable_class)) {
@@ -308,17 +307,16 @@ static void zend_persist_type(zend_type *type) {
list = zend_shared_memdup_put_free(list, ZEND_TYPE_LIST_SIZE(list->num_types));
}
ZEND_TYPE_SET_PTR(*type, list);
+ }
- ZEND_TYPE_LIST_FOREACH(list, list_type) {
- zend_string *type_name = ZEND_TYPE_NAME(*list_type);
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(*type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*single_type);
zend_accel_store_interned_string(type_name);
- ZEND_TYPE_SET_PTR(*list_type, type_name);
- } ZEND_TYPE_LIST_FOREACH_END();
- } else if (ZEND_TYPE_HAS_NAME(*type)) {
- zend_string *type_name = ZEND_TYPE_NAME(*type);
- zend_accel_store_interned_string(type_name);
- ZEND_TYPE_SET_PTR(*type, type_name);
- }
+ ZEND_TYPE_SET_PTR(*single_type, type_name);
+ }
+ } ZEND_TYPE_FOREACH_END();
}
static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_script*
main_persistent_script)
diff --git a/ext/opcache/zend_persist_calc.c b/ext/opcache/zend_persist_calc.c
index a7b347ee0e..e184b03e77 100644
--- a/ext/opcache/zend_persist_calc.c
+++ b/ext/opcache/zend_persist_calc.c
@@ -174,22 +174,21 @@ static void zend_persist_attributes_calc(HashTable *attributes)
static void zend_persist_type_calc(zend_type *type)
{
if (ZEND_TYPE_HAS_LIST(*type)) {
- zend_type *list_type;
if (ZEND_TYPE_USES_ARENA(*type) && !ZCG(is_immutable_class)) {
ADD_ARENA_SIZE(ZEND_TYPE_LIST_SIZE(ZEND_TYPE_LIST(*type)->num_types));
} else {
ADD_SIZE(ZEND_TYPE_LIST_SIZE(ZEND_TYPE_LIST(*type)->num_types));
}
- ZEND_TYPE_LIST_FOREACH(ZEND_TYPE_LIST(*type), list_type) {
- zend_string *type_name = ZEND_TYPE_NAME(*list_type);
- ADD_INTERNED_STRING(type_name);
- ZEND_TYPE_SET_PTR(*list_type, type_name);
- } ZEND_TYPE_LIST_FOREACH_END();
- } else if (ZEND_TYPE_HAS_NAME(*type)) {
- zend_string *type_name = ZEND_TYPE_NAME(*type);
- ADD_INTERNED_STRING(type_name);
- ZEND_TYPE_SET_PTR(*type, type_name);
}
+
+ zend_type *single_type;
+ ZEND_TYPE_FOREACH(*type, single_type) {
+ if (ZEND_TYPE_HAS_NAME(*single_type)) {
+ zend_string *type_name = ZEND_TYPE_NAME(*single_type);
+ ADD_INTERNED_STRING(type_name);
+ ZEND_TYPE_SET_PTR(*single_type, type_name);
+ }
+ } ZEND_TYPE_FOREACH_END();
}
static void zend_persist_op_array_calc_ex(zend_op_array *op_array)