php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66878 Multiple rowsets not returned unless PDO statement object is unset()
Submitted: 2014-03-10 11:59 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: wiktor dot janas at tensquaregames dot com Assigned:
Status: Open Package: PDO MySQL
PHP Version: 5.4.26 OS: Linux
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-03-10 11:59 UTC] wiktor dot janas at tensquaregames dot com
Description:
------------
Hey,

Only the first multiple-result-set query on a given pdo connection works as expected; subsequent queries always claim to have only one result-set (although they have many). This does not happen if PDOStatement used to issue the query is unset(). The communication with the database is correct (checked with wireshark); this is an api issue.

Test script:
---------------
$sql = 'SELECT 123; SELECT 42; SELECT 999';
$pdo = new PDO('mysql:dbname=xxx;host=xxx', 'xxx', 'xxx');

$stmt = $pdo->query($sql);
var_dump($stmt->nextRowset()); /* returns true, as expected */
var_dump($stmt->nextRowset()); /* returns true, as expected */
var_dump($stmt->nextRowset()); /* returns false, as expected */
$stmt->closeCursor();
/* unset($stmt); uncomment this line to make stuff "work" */

$stmt = $pdo->query($sql);
var_dump($stmt->nextRowset()); /* expected: true; got: false */
var_dump($stmt->nextRowset()); /* expected: true; got: false */
var_dump($stmt->nextRowset());
$stmt->closeCursor();
/* unset($stmt); uncomment this line to make stuff "work" */

Expected result:
----------------
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
bool(false)

Actual result:
--------------
bool(true)
bool(true)
bool(false)
bool(false)
bool(false)
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sat Aug 19 22:01:35 2017 UTC