From: xs0 at xs0 dot com
Operating system: Windows Server 2003
PHP version: 5.0.3
PHP Bug Type: MSSQL related
Bug description: crash with batches on zero row queries
Description:
------------
I executed mssql_query("...", $db, 50). The result was empty (no rows
returned), and there was a read from 0x00000000 when (I think)
mssql_fetch_assoc() executed.
Reproduce code:
---------------
I had no time to record the exact code, but it was something like this:
$q=mssql_query("select * from table", $db, 50);
do {
while ($row=mssql_fetch_assoc($q)) {
...
}
} while (mssql_fetch_batch($q)>0);
the table was empty. I then prepended
if (mssql_num_rows($q)>0)
and everything was fine.
Expected result:
----------------
nothing, the table was empty :)
Actual result:
--------------
a crash because of reading 0x00000000
--
Edit bug report at http://bugs.php.net/?id=31818&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31818&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31818&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31818&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31818&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31818&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31818&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31818&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31818&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31818&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31818&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31818&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31818&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31818&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31818&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31818&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31818&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31818&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31818&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31818&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31818&r=mysqlcfg