Skip to content

Commit 15f5572

Browse files
committed
Copy interned strings
1 parent 3e0ec86 commit 15f5572

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,7 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
663663
if (Z_FUNC(p->val)->common.function_name) {
664664
Z_FUNC(p->val)->common.function_name = new_interned_string(Z_FUNC(p->val)->common.function_name);
665665
}
666-
if (Z_FUNC(p->val)->common.arg_info &&
667-
(Z_FUNC(p->val)->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS))) {
666+
if (Z_FUNC(p->val)->common.arg_info) {
668667
uint32_t i;
669668
uint32_t num_args = Z_FUNC(p->val)->common.num_args + 1;
670669
zend_arg_info *arg_info = Z_FUNC(p->val)->common.arg_info - 1;
@@ -673,6 +672,12 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
673672
num_args++;
674673
}
675674
for (i = 0 ; i < num_args; i++) {
675+
if (i > 0) {
676+
arg_info[i].name = new_interned_string(arg_info[i].name);
677+
if (arg_info[i].default_value) {
678+
arg_info[i].default_value = new_interned_string(arg_info[i].default_value);
679+
}
680+
}
676681
accel_copy_permanent_list_types(new_interned_string, arg_info[i].type);
677682
}
678683
}
@@ -714,6 +719,24 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
714719
if (Z_FUNC(q->val)->common.function_name) {
715720
Z_FUNC(q->val)->common.function_name = new_interned_string(Z_FUNC(q->val)->common.function_name);
716721
}
722+
if (Z_FUNC(q->val)->common.scope == ce) {
723+
uint32_t i;
724+
uint32_t num_args = Z_FUNC(q->val)->common.num_args + 1;
725+
zend_arg_info *arg_info = Z_FUNC(q->val)->common.arg_info - 1;
726+
727+
if (Z_FUNC(q->val)->common.fn_flags & ZEND_ACC_VARIADIC) {
728+
num_args++;
729+
}
730+
for (i = 0 ; i < num_args; i++) {
731+
if (i > 0) {
732+
arg_info[i].name = new_interned_string(arg_info[i].name);
733+
if (arg_info[i].default_value) {
734+
arg_info[i].default_value = new_interned_string(arg_info[i].default_value);
735+
}
736+
}
737+
accel_copy_permanent_list_types(new_interned_string, arg_info[i].type);
738+
}
739+
}
717740
} ZEND_HASH_FOREACH_END();
718741

719742
ZEND_HASH_MAP_FOREACH_BUCKET(&ce->constants_table, q) {

0 commit comments

Comments
 (0)