From f33837ff9714105ee11cdedeefd23e674c0043e6 Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Fri, 27 Aug 2010 03:54:10 +0000 Subject: Implemented request #34857 (Change array_combine behaviour when called with empty arrays). Patch by Joel Perras . --- ext/standard/array.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'ext/standard/array.c') 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 && -- cgit v1.2.1