|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-03-26 18:24 UTC] capile at tecnodz dot com
Description: ------------ After first statement/query/exec (successful or not) all the other statements return null as a result. There's nothing relevant in the PDOStatement::errorInfo(). Occurs no matter if the statement cursor was closed or not. Tested on: * Ubuntu 12.10 with both PHP 5.4.6 and 5.4.13 (doesn't work) * Ubuntu 13.04 with PHP 5.4.9 (doesn't work) * Ubuntu 12.04 with PHP 5.3.10 (works) All the installations were made with apt-get (PHP 5.4.13 from http://ppa.launchpad.net/ondrej/php5/ubuntu). All of them use the PDO version 1.0.4dev (got with `php --re pdo`) Test script: --------------- $pdo=new PDO('dblib:host=db;dbname=admin;charset=UTF-8',$username,$password); $statement=$pdo->query('select 1+1 as result'); print_r($statement->fetchAll()); $statement->closeCursor(); $statement=$pdo->query('select 1+1 as result'); print_r($statement->fetchAll()); Expected result: ---------------- Array ( [0] => Array ( [result] => 2 [0] => 2 ) ) Array ( [0] => Array ( [result] => 2 [0] => 2 ) ) Actual result: -------------- Array ( [0] => Array ( [result] => 2 [0] => 2 ) ) Array ( ) PatchesFIX_BUG_64522 (last revision 2013-05-31 04:47 UTC by ssufficool@php.net)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 13:00:01 2025 UTC |
Sorry, I commented without properly testing, just compiled 5.4.15 and tested with $statement = null; and it was possible to keep using the connection, even with transactions. Also works with unset($statement); Test script: --------------- $db->exec('create table #test ( id int not null )'); $db->exec('begin transaction test1'); $db->exec('insert into #test (id) values (100)'); $db->exec('insert into #test (id) values (200)'); $db->exec('insert into #test (id) values (300)'); $db->exec('commit transaction test1'); $stmt = $db->query('select * from #test'); var_dump($stmt->fetchAll(PDO::FETCH_NUM)); $stmt->closeCursor(); unset($stmt); $db->exec('drop table #test'); Expected result: ---------------- array(3) { [0]=> array(1) { [0]=> string(3) "100" } [1]=> array(1) { [0]=> string(3) "200" } [2]=> array(1) { [0]=> string(3) "300" } }