From: mattsoghoian at gmail dot com Operating system: Windows 2003 / FreeBSD PHP version: 5.2.1 PHP Bug Type: Arrays related Bug description: Difference in syntax for mysql_fetch_array
Description: ------------ This is dealing with implementation of the return value of mysql_fetch_array on the following two systems: 1: FreeBSD 6.1-RELEASE Apache 2.2.3 PHP 5.2.0 MySQL 5.0.27-standard 2: Windows Server 2003 SP2 with IIS PHP 5.2.1 MySQL 5.0.37-community Basically, there seems to be two different ways of calling the array returned by mysql_fetch_array which i listed below. the first one is from my unix box, the second is from my windows box. Notice that the second one has quotes around 'columnName', which makes sense for an array, but i've never written code on windows until now, and have always used the first piece of code when writing on *nix. Reproduce code: --------------- $line = mysql_fetch_array($result, MYSQL_ASSOC); echo $line[columnName]; /**** OR ****/ $line = mysql_fetch_array($result, MYSQL_ASSOC); echo $line['columnName']; Expected result: ---------------- expected to echo the cell value of columnName that was pulled from the query. Actual result: -------------- When you run the unquoted code on windows, you get this: PHP Notice: Use of undefined constant id - assumed 'id' in C:\Inetpub\wwwroot\orders\test.php on line 13 where as the quoted OR unquoted version works on unix. here's the buggy part to me: if i do this... echo "$line[columnName]"; where the whole echo is quoted, then it works fine on windows, where sometimes it doesn't like that on unix (i think especially with $_SESSION vars. -- Edit bug report at http://bugs.php.net/?id=41058&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41058&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41058&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41058&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41058&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41058&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41058&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41058&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41058&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41058&r=support Expected behavior: http://bugs.php.net/fix.php?id=41058&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41058&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41058&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41058&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41058&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41058&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41058&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41058&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41058&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41058&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41058&r=mysqlcfg