sixd            Thu Aug 28 06:17:53 2008 UTC

  Added files:                 
    /php-src/ext/oci8/tests     bug45458.phpt 

  Modified files:              
    /php-src/ext/oci8   oci8_interface.c 
  Log:
  Bug #45458 (OCI8: Numeric keys for associative arrays are not handled 
properly)
  
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8_interface.c?r1=1.40&r2=1.41&diff_format=u
Index: php-src/ext/oci8/oci8_interface.c
diff -u php-src/ext/oci8/oci8_interface.c:1.40 
php-src/ext/oci8/oci8_interface.c:1.41
--- php-src/ext/oci8/oci8_interface.c:1.40      Thu Jun  5 23:40:42 2008
+++ php-src/ext/oci8/oci8_interface.c   Thu Aug 28 06:17:53 2008
@@ -25,7 +25,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: oci8_interface.c,v 1.40 2008/06/05 23:40:42 sixd Exp $ */
+/* $Id: oci8_interface.c,v 1.41 2008/08/28 06:17:53 sixd Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1439,7 +1439,7 @@
                                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 @@
                                
                                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 ]));
                        }
                }
 

http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/tests/bug45458.phpt?view=markup&rev=1.1
Index: php-src/ext/oci8/tests/bug45458.phpt
+++ php-src/ext/oci8/tests/bug45458.phpt
--TEST--
Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly)
--SKIPIF--
<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
--FILE--
<?php

require(dirname(__FILE__).'/connect.inc');

// Run Test

echo "Test 1\n";

$stmt = 'select dummy "a", dummy "20" from dual';

$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW);
var_dump($data);
var_dump($data[0]);
var_dump($data[0]["a"]);
var_dump($data[0]["20"]);
oci_free_statement($s);

echo "Test 2\n";

$s = oci_parse($c, $stmt);
oci_execute($s);
$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC);
var_dump($data);
var_dump($data["a"]);
var_dump($data["20"]);
var_dump($data["a"][0]);
var_dump($data["20"][0]);
oci_free_statement($s);

oci_close($c);

?>
===DONE===
<?php exit(0); ?>
--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===



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to