Doc #53647 [NEW]: mysql_num_rows falsely returns NULL on error

From: Date: Tue, 04 Jan 2011 11:18:19 +0000
Subject: Doc #53647 [NEW]: mysql_num_rows falsely returns NULL on error
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-5735@lists.php.net to get a copy of this message
From: Operating system: Ubuntu 10 Server PHP version: Irrelevant Package: MySQL related Bug Type: Documentation Problem Bug description:mysql_num_rows falsely returns NULL on error Description: ------------ mysql_num_rows returns NULL for invalid input data, like Strings/Booleans/Null/etc. In regards to the documentation this should be bool(false) http://php.net/mysql_num_rows "Return Values The number of rows in a result set on success or FALSE on failure." Because it is likely better that invalid input data leads to a different failure handling I propose that you add "or NULL for invalid input data" to the documentation of Return Values to fix this. Test script: --------------- <? var_dump(mysql_num_rows('test')); ?> Expected result: ---------------- bool(false) Actual result: -------------- Warning: mysql_num_rows() expects parameter 1 to be resource, string given in - on line 2 NULL -- Edit bug report at http://bugs.php.net/bug.php?id=53647&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53647&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53647&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53647&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53647&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53647&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53647&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53647&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53647&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53647&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53647&r=support Expected behavior: http://bugs.php.net/fix.php?id=53647&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53647&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53647&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53647&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53647&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53647&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53647&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53647&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53647&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53647&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53647&r=mysqlcfg

« previous php.doc.bugs (#5735) next »