Skip to content

Commit 365cb0d

Browse files
committed
move to only when we are creating new types to be interned
1 parent 4f6e6c3 commit 365cb0d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Zend/zend_API.c

+9-7
Original file line numberDiff line numberDiff line change
@@ -3069,6 +3069,14 @@ static zend_type_node *intern_type_node(zend_type_node *node) {
30693069
}
30703070
}
30713071

3072+
if (node->kind == ZEND_TYPE_SIMPLE) {
3073+
if (ZEND_TYPE_HAS_NAME(node->simple_type)) {
3074+
const zend_string *name = ZEND_TYPE_NAME(node->simple_type);
3075+
zend_string *new_name = zend_string_init_interned(ZSTR_VAL(name), ZSTR_LEN(name), 1);
3076+
ZEND_TYPE_SET_PTR(node->simple_type, new_name);
3077+
}
3078+
}
3079+
30723080
zend_hash_index_add_new_ptr(CG(type_trees), hash, node);
30733081
return node;
30743082
}
@@ -3081,13 +3089,7 @@ ZEND_API zend_type_node *zend_type_to_interned_tree(const zend_type type) {
30813089
if (!ZEND_TYPE_HAS_LIST(type)) {
30823090
zend_type_node *node = pemalloc(sizeof(zend_type_node), 1);
30833091
node->kind = ZEND_TYPE_SIMPLE;
3084-
zend_type new_type = type;
3085-
if (ZEND_TYPE_HAS_NAME(type)) {
3086-
const zend_string *name = ZEND_TYPE_NAME(type);
3087-
zend_string *new_name = zend_string_init_interned(ZSTR_VAL(name), ZSTR_LEN(name), 1);
3088-
ZEND_TYPE_SET_PTR(new_type, new_name);
3089-
}
3090-
node->simple_type = new_type;
3092+
node->simple_type = type;
30913093
return intern_type_node(node);
30923094
}
30933095

0 commit comments

Comments
 (0)