Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.0b5

Bug #12217 Possibly incorrect check for result of mysql_num_rows function
Submitted: 2007-10-10 12:12 UTC
From: zaa Assigned: quipo
Status: Closed Package: MDB2 (version 2.4.1)
PHP Version: 5.2.4 OS: FreeBSD
Roadmaps: (Not assigned)    
Subscription  


 [2007-10-10 12:12 UTC] zaa (Alexander Zhuravlev)
Description: ------------ Hello, According to http://www.php.net/mysql_num_rows page the mysql_num_rows function returns FALSE on failure, but MDB2 MySQL driver has the following code for the numRows function (file: MDB2/Driver/mysql.php, line: 1340) $rows = @mysql_num_rows($this->result); if (is_null($rows)) { ... I've tried to call the function with empty result set and it did not raise the 'resultset has already been freed' exception. Best regards,

Comments

 [2007-10-15 07:46 UTC] zaa (Alexander Zhuravlev)
Just a note. As a solution I offer to replace if (is_null($rows)) { with if ($rows === FALSE) { Best regards,
 [2007-10-15 22:09 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.