summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_def.h
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2013-09-26 18:39:17 +0200
committerNikita Popov <nikic@php.net>2013-09-26 18:39:17 +0200
commit0d7a6388663b76ebed6585ac92dfca5ef65fa7af (patch)
tree1317a8a47c0e4bd1193c8fbf705d91ae75140f78 /Zend/zend_vm_def.h
parent6daa04a4f606f8121d9f1ea6cd90c1c8a684500e (diff)
downloadphp-git-0d7a6388663b76ebed6585ac92dfca5ef65fa7af.tar.gz
Implement variadic function syntax
As per RFC: https://wiki.php.net/rfc/variadics
Diffstat (limited to 'Zend/zend_vm_def.h')
-rw-r--r--Zend/zend_vm_def.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 4621b47e0e..3a513215b2 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -3279,6 +3279,37 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
ZEND_VM_NEXT_OPCODE();
}
+ZEND_VM_HANDLER(164, ZEND_RECV_VARIADIC, ANY, ANY)
+{
+ USE_OPLINE
+ zend_uint arg_num = opline->op1.num;
+ zend_uint arg_count = zend_vm_stack_get_args_count(TSRMLS_C);
+ zval **var_ptr, *params;
+
+ SAVE_OPLINE();
+
+ var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
+ Z_DELREF_PP(var_ptr);
+ MAKE_STD_ZVAL(params);
+ *var_ptr = params;
+
+ if (arg_num <= arg_count) {
+ array_init_size(params, arg_count - arg_num + 1);
+ } else {
+ array_init(params);
+ }
+
+ for (; arg_num <= arg_count; ++arg_num) {
+ zval **param = zend_vm_stack_get_arg(arg_num TSRMLS_CC);
+ zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param, opline->extended_value TSRMLS_CC);
+ zend_hash_next_index_insert(Z_ARRVAL_P(params), param, sizeof(zval *), NULL);
+ Z_ADDREF_PP(param);
+ }
+
+ CHECK_EXCEPTION();
+ ZEND_VM_NEXT_OPCODE();
+}
+
ZEND_VM_HANDLER(52, ZEND_BOOL, CONST|TMP|VAR|CV, ANY)
{
USE_OPLINE