diff options
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r-- | Zend/zend_builtin_functions.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index ed136f5e12..55e5f34e83 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -435,9 +435,7 @@ ZEND_FUNCTION(func_get_arg) } arg = *(p-(arg_count-requested_offset)); - *return_value = *arg; - zval_copy_ctor(return_value); - INIT_PZVAL(return_value); + RETURN_ZVAL_FAST(arg); } /* }}} */ @@ -461,12 +459,17 @@ ZEND_FUNCTION(func_get_args) array_init_size(return_value, arg_count); for (i=0; i<arg_count; i++) { - zval *element; + zval *element, *arg; - ALLOC_ZVAL(element); - *element = **((zval **) (p-(arg_count-i))); - zval_copy_ctor(element); - INIT_PZVAL(element); + arg = *((zval **) (p-(arg_count-i))); + if (!Z_ISREF_P(arg)) { + element = arg; + Z_ADDREF_P(element); + } else { + ALLOC_ZVAL(element); + INIT_PZVAL_COPY(element, arg); + zval_copy_ctor(element); + } zend_hash_next_index_insert(return_value->value.ht, &element, sizeof(zval *), NULL); } } |