From:             MDonatas at centras dot lt
Operating system: Windows XP
PHP version:      4.3.3
PHP Bug Type:     MySQL related
Bug description:  mysql_fetch_array (); returns NULL on connection/querie failure

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 bug report at http://bugs.php.net/?id=25627&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25627&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25627&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25627&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25627&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25627&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25627&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25627&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25627&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25627&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25627&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25627&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25627&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25627&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25627&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25627&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25627&r=float

Reply via email to