From: oooacooo at yahoo dot com
Operating system: Windows 2K Server; Apache 2.0.45
PHP version: 4.3.4
PHP Bug Type: MSSQL related
Bug description: mssql_num_rows() is returning an invalid handle
Description:
------------
When using mssql_execute() with PHP version 4.3.2 mssql_num_rows() will
return 0, when no records are returned from a stored procedure.
When using version 4.3.4 and above mssql_num_rows() will return "supplied
argument is not a valid MS SQL-result
resource"
I tested this by running the code successfully with the php_mssql.dll
which ships with 4.3.2 and then swapped php_mssql.dll with the one that
ships with 4.3.4 and restarted Apache.
Reproduce code:
---------------
$validEpisode = mssql_query("spValidateEpisodeDate " . $AccountID . ",'" .
$inputVisitDate . "'",$db);
if(mssql_num_rows($validEpisode) > 0)
{
$row = mssql_fetch_object($validEpisode);
if($row->Episode_ID == "")
$errorMsg = "There is no episode for this account that
covers the
visit date entered.<br>" . $errorMsg;
else
$EpisodeID = $row->Episode_ID;
}
Expected result:
----------------
If no records are found I would expect "if(mssql_num_rows($validEpisode) >
0)" to return true.
Actual result:
--------------
"if(mssql_num_rows($validEpisode) > 0)" throws an error "supplied argument
is not a valid MS SQL-result
resource"
--
Edit bug report at http://bugs.php.net/?id=28068&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28068&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28068&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28068&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28068&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28068&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28068&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28068&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28068&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28068&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28068&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28068&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28068&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28068&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28068&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28068&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28068&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28068&r=float