Bug #51400 [Opn->Bgs]: mysql_fetch_array() returns NULL
| From: | johannes@php.net | Date: | Fri, 26 Mar 2010 14:08:06 +0000 |
| Subject: | Bug #51400 [Opn->Bgs]: mysql_fetch_array() returns NULL | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149062@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51400&edit=1
ID: 51400
Updated by: johannes@php.net
Reported by: aa at marcandi dot com
Summary: mysql_fetch_array() returns NULL
-Status: Open
+Status: Bogus
Type: Bug
Package: MySQL related
Operating System: CentOS 5.2 (64-bit)
PHP Version: 5.3.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The documentation states
If the parameters given to a function are not what it
expects, such as passing an array where a string is
expected, the return value of the function is undefined.
In this case it will likely return NULL but this is just
a convention, and cannot be relied upon.
http://www.php.net/manual/en/functions.internal.php
You are passing "false" to a function expecting a "mysql result
resource"
Previous Comments:
------------------------------------------------------------------------
[2010-03-26 14:56:18] aa at marcandi dot com
Description:
------------
Calling mysql_fetch_array() with an empty/errorneous result set returns
NULL, not
FALSE. This is a behavioral change from 5.2.10.
Documentation says: "Returns an array of strings that corresponds to the
fetched
row, or FALSE if there are no more rows."
Test script:
---------------
$r = @mysql_query( 'This is a broken query' );
$f = @mysql_fetch_array( $r );
print var_dump( $f );
Expected result:
----------------
FALSE
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51400&edit=1