From:             info at benjamin-wilger dot de
Operating system: Windows
PHP version:      4.4.4
PHP Bug Type:     MSSQL related
Bug description:  mssql_next_result returns FALSE on multiple Resultsets

Description:
------------
mssql_next_result returns FALSE on multiple Resultsets if a simple select
has been executed and the data is fetched before. If one doesn't run a
query before running a multiple query batch (e.g. Stored Procedure) it
works fine. Look at the reproduce code to completly understand the
problem.

Tested on PHP 4.3.11 (*not* buggy), 4.4.1 (*not* buggy), 4.4.2 (buggy),
4.4.3 (buggy), 4.4.4 (buggy), 5.1.4 (buggy).

Reproduce code:
---------------
<?php
mssql_connect(...); mssql_select_db(...);
$result = mssql_query('SELECT 1');
while($row = mssql_fetch_array($result)) {
  $rows_first_query[] = $row;
}

$result = mssql_query('SELECT 1 SELECT 2 SELECT 3'); // Would return three
rows
do {
  while($row = mssql_fetch_array($result)) {
    $rows_first_query[] = $row;
  }
} while ($next_result = mssql_next_result($result)); // Will return FALSE
in any version after 4.4.1 in this case


Expected result:
----------------
On systems with PHP 4.4.1 or lower it will run fine $rows_first_query has
one row
$rows_second_query has *three* rows

Actual result:
--------------
Any version above (including 5.1.x branch) will return just one row in
$rows_second_query.

WORKAROUND to get it running: Run mssql_free_result() after the every
fetching of data.

-- 
Edit bug report at http://bugs.php.net/?id=38924&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38924&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38924&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38924&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38924&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38924&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38924&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38924&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38924&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38924&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38924&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38924&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38924&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38924&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38924&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38924&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38924&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38924&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38924&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38924&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38924&r=mysqlcfg

Reply via email to