Bug #72211 [NEW]: Associative array returns not = Numeric array

From: Date: Thu, 12 May 2016 22:07:32 +0000
Subject: Bug #72211 [NEW]: Associative array returns not = Numeric array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201051@lists.php.net to get a copy of this message
From: 4OtherBusiness at comcast dot net Operating system: Windows 7 Enterprise PHP version: 5.6Git-2016-05-12 (snap) Package: MySQLi related Bug Type: Bug Bug description:Associative array returns not = Numeric array Description: ------------ Inside my PHP do_mysql_multi() funct that does querying, I kept getting nonsense until I put this first echo just below the while () shown here. (Using newer mysqli not mysql functions.) Basically the associative value is wrong, the numeric indexed value is correct for first element of first (only) row. Putting: echo "<pre>"; print_r($row) ; Shows the nonsense when placed after the test for result = mysqli_store_result($link) 75 columns expected c/o SELECT tbl1.*, tbl2.*, tbl3.*, tbl4.*, tbl5.* .... First few fields (of the 1 return row) shown here. Notice first element. Should be = 101, (= where clause value) Array ( [0] => 101 [modem_config_id] => 1 [1] => 1 [modem_activity_id] => 1 [2] => 1 [customer_id] => 1 [3] => 1 [aircraft_id] => 1 [4] => 1 [intl_rate_plan_id] => 1 [5] => 1 [dom_rate_plan_id] => 1 [6] => U064672 [serial_number] => U064672 ... All the rest are good Test script: --------------- if (mysqli_multi_query($link,$query )) { do { if ($result = mysqli_store_result($link)) { $row_nbr=0 ; while ($row = mysqli_fetch_array($result, MYSQLI_BOTH)) { $row_nbr++ ; for ($field_nbr=1;$field_nbr<=$fields_returned;$field_nbr++) { $values[$row_nbr][$field_names[$field_nbr]] =$row[$field_nbr-1] ; } } mysqli_free_result($result) ; } // EO if ($result = mysqli_store_result($link)) } while (mysqli_more_results($link) && mysqli_next_result($link)) ; } // EO if (mysqli_multi_query($link,$query )) else { // This will be true if the 1st query failed if ($query_nbr == 0) { $result_vector1['Error'] = "MySQL Error #: ".mysqli_errno($link).": ".mysqli_error($link) ; $result_vector2['Error'] = "MySQL Error in first query." ; } } // EO MySQL Expected result: ---------------- I expect [0] value to equal ['modem_config_id'] value. -- Edit bug report at https://bugs.php.net/bug.php?id=72211&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72211&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72211&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72211&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=72211&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=72211&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=72211&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=72211&r=needscript Try newer version: https://bugs.php.net/fix.php?id=72211&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=72211&r=support Expected behavior: https://bugs.php.net/fix.php?id=72211&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=72211&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=72211&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=72211&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72211&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=72211&r=dst IIS Stability: https://bugs.php.net/fix.php?id=72211&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=72211&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=72211&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=72211&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=72211&r=mysqlcfg

« previous php.bugs (#201051) next »