]> granicus.if.org Git - php/commitdiff
Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
authorIlia Alshanetsky <iliaa@php.net>
Sun, 11 Jul 2004 15:23:57 +0000 (15:23 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 11 Jul 2004 15:23:57 +0000 (15:23 +0000)
NEWS
ext/standard/array.c

diff --git a/NEWS b/NEWS
index 06cb0bc62c93182ff114e0bf7c76445e83c2bc73..fb39b2d25f6ecae7e634232f847106111ed084dc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP                                                                        NEWS
 - Updated PCRE to provide better error handling in certain cases. (Andrei)
 - Changed doc comments to require a single white space after '/**'. (Marcus)
 - Fixed bug #29019 (Database not closing). (Marcus)
+- Fixed bug #29008 (array_combine() does not handle non-numeric/string keys).
+  (Ilia)
 - Fixed bug #28895 (ReflectionClass::isAbstract always returns false). (Marcus)
 - Fixed bug #28868 (Internal filter registry not thread safe). (Sara)
 - Fixed bug #28851 (call_user_func_array has typo in error message). (Marcus)
index d9c0216f8dd6ceb612e9932e69e4b78c96f2a810..e7bc0a8e437b6621f84d98e68c96c257e68a0834 100644 (file)
@@ -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);