Bug #73530 [Asn->Csd]: Unsetting result set may reset other result set

From: Date: Wed, 16 Nov 2016 11:14:37 +0000
Subject: Bug #73530 [Asn->Csd]: Unsetting result set may reset other result set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205403@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73530&edit=1 ID: 73530 Updated by: cmb@php.net Reported by: cmb@php.net Summary: Unsetting result set may reset other result set -Status: Assigned +Status: Closed Type: Bug Package: SQLite related Operating System: * PHP Version: master-Git-2016-11-15 (Git) Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=eb570294a289b45d0dd38efc71065d6b0d314c4b Log: Fix #73530: Unsetting result set may reset other result set Previous Comments: ------------------------------------------------------------------------ [2016-11-15 18:53:07] cmb@php.net 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 this bug report at https://bugs.php.net/bug.php?id=73530&edit=1

« previous php.bugs (#205403) next »