summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-07-11 15:23:57 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-07-11 15:23:57 +0000
commit4ebcb2ecfecc55967d96f0c911b92b980be1b284 (patch)
tree3d44167d370bacc15416cfba3d38da134da58346 /ext
parented6ebf011bcb14a7097cad97667f8042a3175a0d (diff)
downloadphp-git-4ebcb2ecfecc55967d96f0c911b92b980be1b284.tar.gz
Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/array.c11
1 files changed, 11 insertions, 0 deletions
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);