Bug #79084 [NEW]: mysqli fetch_array returns different results on PHP 7.3+ with some column names

From: Date: Wed, 08 Jan 2020 19:03:37 +0000
Subject: Bug #79084 [NEW]: mysqli fetch_array returns different results on PHP 7.3+ with some column names
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224788@lists.php.net to get a copy of this message
From: rob-phpbugs at tigertech dot com Operating system: Linux PHP version: 7.3.13 Package: MySQLi related Bug Type: Bug Bug description:mysqli fetch_array returns different results on PHP 7.3+ with some column names Description: ------------ If a query has column names that are all numeric, like this: SELECT * FROM (SELECT 0 as 2007, 0 as 2008, 0 as 2020) AS x; And you use "fetch_array()" on it, PHP 7.2 gives this result: Array ( [0] => 0 [2007] => 0 [1] => 0 [2008] => 0 [2] => 0 [2020] => 0 ) But PHP 7.3 and 7.4 give this result: Array ( [0] => 0 [2007] => 0 [2008] => 0 [2009] => 0 [2020] => 0 ) The latter is wrong: it should not contain "2009", and it is missing "[1]" and "[2]". Test script: --------------- <?php $mysqli = mysqli_connect("localhost", "user", "password", "db"); $sql = "SELECT * FROM (SELECT 0 as 2007, 0 as 2008, 0 as 2020) AS x"; $res = $mysqli->query($sql); $row = $res->fetch_array(); echo print_r($row, 1); Expected result: ---------------- Array ( [0] => 0 [2007] => 0 [1] => 0 [2008] => 0 [2] => 0 [2020] => 0 ) Actual result: -------------- Array ( [0] => 0 [2007] => 0 [2008] => 0 [2009] => 0 [2020] => 0 ) -- Edit bug report at https://bugs.php.net/bug.php?id=79084&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79084&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79084&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79084&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79084&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79084&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79084&r=support Expected behavior: https://bugs.php.net/fix.php?id=79084&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79084&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79084&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79084&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79084&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79084&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79084&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79084&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79084&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79084&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79084&r=mysqlcfg

« previous php.bugs (#224788) next »