#25627 [Opn->Bgs]: mysql_fetch_array (); returns NULL on connection/querie failure
| From: | iliaa@php.net | Date: | Mon, 22 Sep 2003 22:52:38 +0000 |
| Subject: | #25627 [Opn->Bgs]: mysql_fetch_array (); returns NULL on connection/querie failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47961@lists.php.net to get a copy of this message | ||
ID: 25627
Updated by: iliaa@php.net
Reported By: MDonatas at centras dot lt
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: Windows XP
PHP Version: 4.3.3
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
You are supposed to provide correct arguments to the function. If they
query has failed you should return value then, not pass it to another
function.
Previous Comments:
------------------------------------------------------------------------
[2003-09-22 09:00:56] MDonatas at centras dot lt
Description:
------------
In documentation for mysql_fetch_array (); it says "Returns an array
that corresponds to the fetched row, or FALSE if there are no more
rows."
But if connection to database fails or querie is somewhat wrong, this
function will return NULL which is defenitely wrong.
if you have script like
while (FALSE !== ($info = mysql_fetch_array ($result)))
{
...
}
then it will start infinite loop.
Reproduce code:
---------------
<?
//WARNING! This will start infinite loop
while (FALSE !== ($info = mysql_fetch_array ($result)))
{
}
?>
Expected result:
----------------
Should return FALSE on any failures
Actual result:
--------------
Returns NULL on failures.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25627&edit=1