1--TEST-- 2Bug #45458 (OCI8: Numeric keys for associative arrays are not handled properly) 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> 5--FILE-- 6<?php 7 8require(__DIR__.'/connect.inc'); 9 10// Run Test 11 12echo "Test 1\n"; 13 14$stmt = 'select dummy "A", dummy "20" from dual'; 15 16$s = oci_parse($c, $stmt); 17oci_execute($s); 18$r = oci_fetch_all($s, $data, 0, -1, OCI_FETCHSTATEMENT_BY_ROW); 19var_dump($data); 20var_dump($data[0]); 21var_dump($data[0]["A"]); 22var_dump($data[0]["20"]); 23oci_free_statement($s); 24 25echo "Test 2\n"; 26 27$s = oci_parse($c, $stmt); 28oci_execute($s); 29$r = oci_fetch_all($s, $data, 0, -1, OCI_ASSOC); 30var_dump($data); 31var_dump($data["A"]); 32var_dump($data["20"]); 33var_dump($data["A"][0]); 34var_dump($data["20"][0]); 35oci_free_statement($s); 36 37oci_close($c); 38 39?> 40--EXPECT-- 41Test 1 42array(1) { 43 [0]=> 44 array(2) { 45 ["A"]=> 46 string(1) "X" 47 [20]=> 48 string(1) "X" 49 } 50} 51array(2) { 52 ["A"]=> 53 string(1) "X" 54 [20]=> 55 string(1) "X" 56} 57string(1) "X" 58string(1) "X" 59Test 2 60array(2) { 61 ["A"]=> 62 array(1) { 63 [0]=> 64 string(1) "X" 65 } 66 [20]=> 67 array(1) { 68 [0]=> 69 string(1) "X" 70 } 71} 72array(1) { 73 [0]=> 74 string(1) "X" 75} 76array(1) { 77 [0]=> 78 string(1) "X" 79} 80string(1) "X" 81string(1) "X" 82