From 4ebcb2ecfecc55967d96f0c911b92b980be1b284 Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Sun, 11 Jul 2004 15:23:57 +0000 Subject: Fixed bug #29008 (array_combine() does not handle non-numeric/string keys). --- ext/standard/array.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ext/standard/array.c') diff --git a/ext/standard/array.c b/ext/standard/array.c index d9c0216f8d..e7bc0a8e43 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -4246,6 +4246,17 @@ PHP_FUNCTION(array_combine) } else if (Z_TYPE_PP(entry_keys) == IS_LONG) { zval_add_ref(entry_values); add_index_zval(return_value, Z_LVAL_PP(entry_keys), *entry_values); + } else { + zval key; + + key = **entry_keys; + zval_copy_ctor(&key); + convert_to_string(&key); + + zval_add_ref(entry_values); + add_assoc_zval(return_value, Z_STRVAL(key), *entry_values); + + zval_dtor(&key); } zend_hash_move_forward_ex(Z_ARRVAL_P(keys), &pos_keys); zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos_values); -- cgit v1.2.1