summaryrefslogtreecommitdiff
path: root/ext/standard/array.c
diff options
context:
space:
mode:
authorAdam Harvey <aharvey@php.net>2010-08-27 03:54:10 +0000
committerAdam Harvey <aharvey@php.net>2010-08-27 03:54:10 +0000
commitf33837ff9714105ee11cdedeefd23e674c0043e6 (patch)
treea344ab2778dda829e16aa466c5f668ad0e807c65 /ext/standard/array.c
parent0f3468330445904566c508916f25d8275c8cafd5 (diff)
downloadphp-git-f33837ff9714105ee11cdedeefd23e674c0043e6.tar.gz
Implemented request #34857 (Change array_combine behaviour when called with
empty arrays). Patch by Joel Perras <joel.perras@gmail.com>.
Diffstat (limited to 'ext/standard/array.c')
-rw-r--r--ext/standard/array.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 99b9e78c31..ee3c5ae75a 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -4481,13 +4481,12 @@ PHP_FUNCTION(array_combine)
RETURN_FALSE;
}
+ array_init_size(return_value, num_keys);
+
if (!num_keys) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Both parameters should have at least 1 element");
- RETURN_FALSE;
+ return;
}
- array_init_size(return_value, num_keys);
-
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(keys), &pos_keys);
zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos_values);
while (zend_hash_get_current_data_ex(Z_ARRVAL_P(keys), (void **)&entry_keys, &pos_keys) == SUCCESS &&