Bug #73530 [NEW]: Unsetting result set may reset other result set
| From: | cmb@php.net | Date: | Tue, 15 Nov 2016 18:53:11 +0000 |
| Subject: | Bug #73530 [NEW]: Unsetting result set may reset other result set | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-205393@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: master-Git-2016-11-15 (Git)
Package: SQLite related
Bug Type: Bug
Bug description:Unsetting result set may reset other result set
Description:
------------
Due to the implementation, interference of multiple result set
objects retrieved by executing the same statement object are to be
expected[1]. However, unsetting a result set while iterating
over another shouldn't reset the other result set.
[1] <http://svn.php.net/viewvc?view=revision&revision=341033>
Test script:
---------------
<?php
$db = new SQLite3(':memory:');
$db->exec("CREATE TABLE foo (num int)");
$db->exec("INSERT INTO foo VALUES (0)");
$db->exec("INSERT INTO foo VALUES (1)");
$stmt = $db->prepare("SELECT * FROM foo WHERE NUM = ?");
$stmt->bindValue(1, 0, SQLITE3_INTEGER);
$res1 = $stmt->execute();
while ($row = $res1->fetchArray(SQLITE3_ASSOC)) {
var_dump($row);
}
$stmt->clear();
$stmt->reset();
$res1->finalize();
echo "finished first pass\n";
$stmt->bindValue(1, 1, SQLITE3_INTEGER);
$res2 = $stmt->execute();
while ($row = $res2->fetchArray(SQLITE3_ASSOC)) {
var_dump($row);
unset($res1);
}
Expected result:
----------------
array(1) {
["num"]=>
int(0)
}
finished first pass
array(1) {
["num"]=>
int(1)
}
Actual result:
--------------
array(1) {
["num"]=>
int(0)
}
finished first pass
array(1) {
["num"]=>
int(1)
}
array(1) {
["num"]=>
int(1)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=73530&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73530&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73530&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73530&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73530&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73530&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73530&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73530&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73530&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73530&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73530&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73530&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73530&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73530&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73530&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73530&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73530&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73530&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73530&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73530&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73530&r=mysqlcfg