Skip to content

Commit 5afd492

Browse files
committed
WIP
1 parent 0d3b6c7 commit 5afd492

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Zend/zend_vm_def.h

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5039,6 +5039,7 @@ ZEND_VM_C_LABEL(send_again):
50395039
break;
50405040
}
50415041

5042+
zend_string *name = NULL;
50425043
if (iter->funcs->get_current_key) {
50435044
zval key;
50445045
iter->funcs->get_current_key(iter, &key);
@@ -5048,15 +5049,24 @@ ZEND_VM_C_LABEL(send_again):
50485049

50495050
// TODO: Support named params.
50505051
if (UNEXPECTED(Z_TYPE(key) != IS_LONG)) {
5051-
zend_throw_error(NULL,
5052-
(Z_TYPE(key) == IS_STRING) ?
5053-
"Cannot unpack Traversable with string keys" :
5054-
"Cannot unpack Traversable with non-integer keys");
5055-
zval_ptr_dtor(&key);
5056-
break;
5052+
if (UNEXPECTED(Z_TYPE(key) != IS_STRING)) {
5053+
zend_throw_error(NULL,
5054+
"Keys must be of type int|string during argument unpacking");
5055+
zval_ptr_dtor(&key);
5056+
break;
5057+
}
5058+
5059+
name = Z_STR_P(&key);
50575060
}
50585061
}
50595062

5063+
if (name) {
5064+
void *cache_slot[2] = {NULL, NULL};
5065+
have_named_params = 1;
5066+
top = zend_handle_named_arg(&EX(call), name, &arg_num, cache_slot);
5067+
} else {
5068+
}
5069+
50605070
if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
50615071
zend_error(
50625072
E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()"
@@ -5075,6 +5085,9 @@ ZEND_VM_C_LABEL(send_again):
50755085
ZVAL_COPY_VALUE(top, arg);
50765086
ZEND_CALL_NUM_ARGS(EX(call))++;
50775087

5088+
if (name) {
5089+
zend_string_release(name);
5090+
}
50785091
iter->funcs->move_forward(iter);
50795092
}
50805093

0 commit comments

Comments
 (0)