1--TEST-- 2Bug #71600 (oci_fetch_all result in segfault when select more than 8 columns) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9?> 10--FILE-- 11<?php 12 13require(__DIR__.'/connect.inc'); 14 15// Initialize 16 17$stmtarray = array( 18 "create table bug71600_tab (col1 number, col2 number, col3 number, 19 col4 number, col5 number, col6 number, 20 col7 number, col8 number, col9 number)", 21 "insert into bug71600_tab values(1, 2, 3, 4, 5, 6, 7, 8, 9)", 22 "insert into bug71600_tab values(11, 12, 13, 14, 15, 16, 17, 18, 19)" 23); 24 25oci8_test_sql_execute($c, $stmtarray); 26 27// Run test 28 29$sql = "select col1,col2,col3,col4,col5,col6,col7,col8,col9 from bug71600_tab"; 30 31echo "Test 1\n"; 32$stmt = oci_parse($c, $sql); 33 34echo "Executing SELECT statament...\n"; 35oci_execute($stmt,OCI_DEFAULT); 36 37echo "Fetching data by columns...\n"; 38oci_fetch_all($stmt, $result); 39oci_free_statement($stmt); 40 41$rsRows=(count($result,1)/($rows = count($result,0)))-1; 42echo "$rsRows Records Found\n"; 43$rsCount=0; 44while($rsCount < $rsRows) 45{ 46 $col1 =$result['COL1'][$rsCount]; 47 $col9 =$result['COL9'][$rsCount]; 48 echo "$rsCount|$col1|$col9\n"; 49 $rsCount++; 50} 51 52echo "Test 2\n"; 53$stmt = oci_parse($c, $sql); 54 55echo "Re-executing SELECT statament...\n"; 56oci_execute($stmt,OCI_DEFAULT); 57 58echo "Fetching data by rows...\n"; 59oci_fetch_all($stmt, $result, 0, -1, OCI_FETCHSTATEMENT_BY_ROW); 60oci_free_statement($stmt); 61 62$rsRows=count($result,0); 63echo "$rsRows Records Found\n"; 64$rsCount=0; 65while($rsCount < $rsRows) 66{ 67 $col1 = $result[$rsCount]['COL1']; 68 $col9 = $result[$rsCount]['COL9']; 69 echo "$rsCount|$col1|$col9\n"; 70 $rsCount++; 71} 72 73 74// Cleanup 75 76$stmtarray = array( 77 "drop table bug71600_tab" 78); 79 80oci8_test_sql_execute($c, $stmtarray); 81 82?> 83--EXPECT-- 84Test 1 85Executing SELECT statament... 86Fetching data by columns... 872 Records Found 880|1|9 891|11|19 90Test 2 91Re-executing SELECT statament... 92Fetching data by rows... 932 Records Found 940|1|9 951|11|19 96