Skip to content

Commit 84a843d

Browse files
committed
Use better function
1 parent 8c001d5 commit 84a843d

File tree

5 files changed

+16
-14
lines changed

5 files changed

+16
-14
lines changed

Zend/zend_builtin_functions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ static inline void get_declared_class_impl(INTERNAL_FUNCTION_PARAMETERS, int fla
12781278
ZEND_ASSERT(Z_TYPE_P(zv) == IS_ALIAS_PTR);
12791279
ZVAL_STR_COPY(&tmp, key);
12801280
}
1281-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &tmp);
1281+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
12821282
}
12831283
} ZEND_HASH_FOREACH_END();
12841284
}

Zend/zend_enum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static ZEND_NAMED_FUNCTION(zend_enum_cases_func)
236236
}
237237
}
238238
Z_ADDREF_P(zv);
239-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), zv);
239+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), zv);
240240
} ZEND_HASH_FOREACH_END();
241241
}
242242

Zend/zend_weakrefs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static HashTable *zend_weakmap_get_properties_for(zend_object *object, zend_prop
411411
Z_TRY_ADDREF_P(val);
412412
add_assoc_zval(&pair, "value", val);
413413

414-
zend_hash_next_index_insert(ht, &pair);
414+
zend_hash_next_index_insert_new(ht, &pair);
415415
} ZEND_HASH_FOREACH_END();
416416

417417
return ht;

ext/reflection/php_reflection.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,7 @@ ZEND_METHOD(ReflectionFunctionAbstract, getParameters)
20462046
i < fptr->common.required_num_args,
20472047
&parameter
20482048
);
2049-
add_next_index_zval(return_value, &parameter);
2049+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &parameter);
20502050

20512051
arg_info++;
20522052
}
@@ -4239,7 +4239,7 @@ ZEND_METHOD(ReflectionClass, getMethod)
42394239
/* }}} */
42404240

42414241
/* {{{ _addmethod */
4242-
static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval, zend_long filter)
4242+
static void _addmethod(zend_function *mptr, zend_class_entry *ce, HashTable *ht, zend_long filter)
42434243
{
42444244
if ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && mptr->common.scope != ce) {
42454245
return;
@@ -4248,7 +4248,7 @@ static void _addmethod(zend_function *mptr, zend_class_entry *ce, zval *retval,
42484248
if (mptr->common.fn_flags & filter) {
42494249
zval method;
42504250
reflection_method_factory(ce, mptr, NULL, &method);
4251-
add_next_index_zval(retval, &method);
4251+
zend_hash_next_index_insert_new(ht, &method);
42524252
}
42534253
}
42544254
/* }}} */
@@ -4274,7 +4274,7 @@ ZEND_METHOD(ReflectionClass, getMethods)
42744274

42754275
array_init(return_value);
42764276
ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) {
4277-
_addmethod(mptr, ce, return_value, filter);
4277+
_addmethod(mptr, ce, Z_ARRVAL_P(return_value), filter);
42784278
} ZEND_HASH_FOREACH_END();
42794279

42804280
if (instanceof_function(ce, zend_ce_closure)) {
@@ -4289,7 +4289,7 @@ ZEND_METHOD(ReflectionClass, getMethods)
42894289
}
42904290
zend_function *closure = zend_get_closure_invoke_method(obj);
42914291
if (closure) {
4292-
_addmethod(closure, ce, return_value, filter);
4292+
_addmethod(closure, ce, Z_ARRVAL_P(return_value), filter);
42934293
}
42944294
if (!has_obj) {
42954295
zval_ptr_dtor(&obj_tmp);
@@ -4392,7 +4392,7 @@ ZEND_METHOD(ReflectionClass, getProperty)
43924392
/* }}} */
43934393

43944394
/* {{{ _addproperty */
4395-
static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_entry *ce, zval *retval, long filter)
4395+
static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_entry *ce, HashTable *ht, long filter)
43964396
{
43974397
if ((pptr->flags & ZEND_ACC_PRIVATE) && pptr->ce != ce) {
43984398
return;
@@ -4401,7 +4401,7 @@ static void _addproperty(zend_property_info *pptr, zend_string *key, zend_class_
44014401
if (pptr->flags & filter) {
44024402
zval property;
44034403
reflection_property_factory(ce, key, pptr, &property);
4404-
add_next_index_zval(retval, &property);
4404+
zend_hash_next_index_insert_new(ht, &property);
44054405
}
44064406
}
44074407
/* }}} */
@@ -4450,7 +4450,7 @@ ZEND_METHOD(ReflectionClass, getProperties)
44504450

44514451
array_init(return_value);
44524452
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->properties_info, key, prop_info) {
4453-
_addproperty(prop_info, key, ce, return_value, filter);
4453+
_addproperty(prop_info, key, ce, Z_ARRVAL_P(return_value), filter);
44544454
} ZEND_HASH_FOREACH_END();
44554455

44564456
if (Z_TYPE(intern->obj) != IS_UNDEF && (filter & ZEND_ACC_PUBLIC) != 0) {
@@ -4543,7 +4543,7 @@ ZEND_METHOD(ReflectionClass, getReflectionConstants)
45434543
if (Z_ACCESS_FLAGS(constant->value) & filter) {
45444544
zval class_const;
45454545
reflection_class_constant_factory(name, constant, &class_const);
4546-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &class_const);
4546+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &class_const);
45474547
}
45484548
} ZEND_HASH_FOREACH_END();
45494549
}
@@ -6626,7 +6626,7 @@ ZEND_METHOD(ReflectionEnum, getCases)
66266626
if (Z_ACCESS_FLAGS(constant->value) & ZEND_CLASS_CONST_IS_CASE) {
66276627
zval class_const;
66286628
reflection_enum_case_factory(ce, name, constant, &class_const);
6629-
zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &class_const);
6629+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &class_const);
66306630
}
66316631
} ZEND_HASH_FOREACH_END();
66326632
}

ext/standard/dir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ PHP_FUNCTION(glob)
407407
size_t n;
408408
int ret;
409409
bool basedir_limit = 0;
410+
zval tmp;
410411

411412
ZEND_PARSE_PARAMETERS_START(1, 2)
412413
Z_PARAM_PATH(pattern, pattern_len)
@@ -510,7 +511,8 @@ PHP_FUNCTION(glob)
510511
continue;
511512
}
512513
}
513-
add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip);
514+
ZVAL_STRING(&tmp, globbuf.gl_pathv[n]+cwd_skip);
515+
zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &tmp);
514516
}
515517

516518
globfree(&globbuf);

0 commit comments

Comments
 (0)