From 23b226862a71d99dfb07f9048bc31bc3ff4e4f22 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 28 Aug 2008 06:17:53 +0000 Subject: [PATCH] Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly) --- ext/oci8/oci8_interface.c | 4 +- ext/oci8/tests/bug45458.phpt | 84 ++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 ext/oci8/tests/bug45458.phpt diff --git a/ext/oci8/oci8_interface.c b/ext/oci8/oci8_interface.c index 4516601e90..e49a39e35a 100644 --- a/ext/oci8/oci8_interface.c +++ b/ext/oci8/oci8_interface.c @@ -1439,7 +1439,7 @@ PHP_FUNCTION(oci_fetch_all) if (flags & PHP_OCI_NUM) { zend_hash_next_index_insert(Z_ARRVAL_P(row), &element, sizeof(zval*), NULL); } else { /* default to ASSOC */ - zend_u_hash_update(Z_ARRVAL_P(row), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); + zend_u_symtable_update(Z_ARRVAL_P(row), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, &element, sizeof(zval*), NULL); } } @@ -1471,7 +1471,7 @@ PHP_FUNCTION(oci_fetch_all) MAKE_STD_ZVAL(tmp); array_init(tmp); - zend_u_hash_update(Z_ARRVAL_P(array), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); + zend_u_symtable_update(Z_ARRVAL_P(array), (UG(unicode) ? IS_UNICODE : IS_STRING), columns[ i ]->name, columns[ i ]->name_len+1, (void *) &tmp, sizeof(zval*), (void **) &(outarrs[ i ])); } } diff --git a/ext/oci8/tests/bug45458.phpt b/ext/oci8/tests/bug45458.phpt new file mode 100644 index 0000000000..f68c1c2548 --- /dev/null +++ b/ext/oci8/tests/bug45458.phpt @@ -0,0 +1,84 @@ +--TEST-- +Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly) +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECT-- +Test 1 +array(1) { + [0]=> + array(2) { + [u"a"]=> + unicode(1) "X" + [20]=> + unicode(1) "X" + } +} +array(2) { + [u"a"]=> + unicode(1) "X" + [20]=> + unicode(1) "X" +} +unicode(1) "X" +unicode(1) "X" +Test 2 +array(2) { + [u"a"]=> + array(1) { + [0]=> + unicode(1) "X" + } + [20]=> + array(1) { + [0]=> + unicode(1) "X" + } +} +array(1) { + [0]=> + unicode(1) "X" +} +array(1) { + [0]=> + unicode(1) "X" +} +unicode(1) "X" +unicode(1) "X" +===DONE=== -- 2.50.1