From: grzegorz at heex dot pl
Operating system: Windows XP Sp3
PHP version: 5.2.6
PHP Bug Type: PDO related
Bug description: PDO_MSSQL problem if query return no result
Description:
------------
If PDO_MSSQL PDOStatement is called 2 times and the first returned no
result than second one return strange result.
PDO_MYSQL works fine.
Tested on Apache and IIS
Reproduce code:
---------------
$pdo = new PDO("mssql:host=[host];dbname=[base]",[user],[pass]);
$sth = $pdo->prepare("SELECT id FROM sometable WHERE id=:parentId");
$sth->execute(array(':parentId'=>1));
//or
//$sth->bindValue(':parentId',1,PDO::PARAM_INT);
$res1 = $sth->fetchAll();
$sth->closeCursor();
$sth->execute(array(':parentId'=>2));
//or
//$sth->bindValue(':parentId',2,PDO::PARAM_INT);
$res2 = $sth->fetchAll();
$sth->closeCursor();
Expected result:
----------------
$res1 = array[0] //empty
$res2 = array[
0 = array['value' => 3]
1 = array['value' => 6]
]
Actual result:
--------------
$res1 = array[0] //empty
$res2 = array[
0 = array['[]' => null]
1 = array['[]' => null]
]
--
Edit bug report at http://bugs.php.net/?id=45951&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45951&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45951&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45951&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45951&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45951&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45951&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45951&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45951&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45951&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45951&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45951&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45951&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45951&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45951&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45951&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45951&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45951&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45951&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45951&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45951&r=mysqlcfg