|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-03-01 03:56 UTC] brad at wcubed dot net
[2013-05-31 21:44 UTC] ssufficool@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: ssufficool
[2013-05-31 21:44 UTC] ssufficool@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 04:00:01 2025 UTC |
Description: ------------ Environment: MS SQL Server 2008 R2 FreeTSD 0.64_9,1 No results are returned from dblib PDO::query() + PDOStatement::fetchAll() if the same variable is re-used from a previous query/fetch. If the variable is unset() before the second query, the behavior is as expected. This problem is reproducible on both a fresh install of FreeBSD 9.1 and longstanding 8.2 install. This behavior was not evident on the FreeBSD 8.2 install prior to a php upgrade from 5.3.8 to 5.4.12. Test script: --------------- $dbh = new PDO("dblib:host=$host;dbname=$dbname", $user, $pass); $create = $dbh->exec('DROP TABLE foo'); $create = $dbh->exec('CREATE TABLE foo (ID int PRIMARY KEY IDENTITY (1,1) NOT NULL, bar VARCHAR(10))'); $insert = $dbh->exec('INSERT INTO foo (bar) VALUES (\'baz\')'); $qry = 'select * from foo'; $stmt = $dbh->query($qry); $results = $stmt->fetchAll(PDO::FETCH_NUM); print_r($results); $stmt = $dbh->query($qry); $results = $stmt->fetchAll(PDO::FETCH_NUM); print_r($results); unset($stmt); $stmt = $dbh->query($qry); $results = $stmt->fetchAll(PDO::FETCH_NUM); print_r($results); Expected result: ---------------- Array ( [0] => Array ( [0] => 1 [1] => baz ) ) Array ( ) Array ( [0] => Array ( [0] => 1 [1] => baz ) ) Actual result: -------------- Array ( [0] => Array ( [0] => 1 [1] => baz ) ) Array ( [0] => Array ( [0] => 1 [1] => baz ) ) Array ( [0] => Array ( [0] => 1 [1] => baz ) )