php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64172 errorInfo is not properly cleaned up
Submitted: 2013-02-08 07:55 UTC Modified: 2014-06-04 09:01 UTC
From: dmitry dot vasilev at gmail dot com Assigned:
Status: Closed Package: PDO Core
PHP Version: 5.4.11 OS: Irrelevant
Private report: No CVE-ID: None
 [2013-02-08 07:55 UTC] dmitry dot vasilev at gmail dot com
Description:
------------
Affects at least PgSQL driver (MySQL works fine). 

Workflow:
1. Make invalid query - errorInfo()[2] contains error info. Error code is not 
zero.
2. Make valid query - errorInfo()[2] still contains an error from the first step 
(but error code is 0).

pdo_pgsql:
libpq version 9.0.8
Module version: 1.0.2


Test script:
---------------
$pdo->exec("SELECT * FROM bad_table;");
echo $pdo->errorInfo()[2]; // "relation bad_table doesn't exist"

$pdo->exec("SELECT * FROM good_table;");
echo $pdo->errorInfo()[2]; // "relation bad_table doesn't exist". Expected "".

Expected result:
----------------
""

Actual result:
--------------
"relation bad_table doesn't exist"

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-01 12:33 UTC] felipe@php.net
-Package: PDO related +Package: PDO PgSQL
 [2014-06-04 09:01 UTC] mbeccati@php.net
-Summary: errorInfo doesn't cleans up properly +Summary: errorInfo is not properly cleaned up -Status: Open +Status: Verified -Package: PDO PgSQL +Package: PDO Core -Operating System: FreeBSD 8.2 +Operating System: Irrelevant
 [2014-06-04 09:01 UTC] mbeccati@php.net
I started writing a new common phpt file in order to check the behaviour of drivers other then pgsql and it seems that pdo_sqlite and pdo_mysql are affected too, so I'm changing the bug type to PDO Core.
 [2015-10-19 00:58 UTC] stas@php.net
Automatic comment on behalf of daniel.persson@textalk.se
Revision: http://git.php.net/?p=php-src.git;a=commit;h=73384728cadfc28ae6c621636de25fdada464e5b
Log: Fix bug #64172
 [2015-10-19 00:58 UTC] stas@php.net
-Status: Verified +Status: Closed
 [2015-10-19 00:58 UTC] stas@php.net
Automatic comment on behalf of daniel.persson@textalk.se
Revision: http://git.php.net/?p=php-src.git;a=commit;h=307c1f6bf0e8e3c97416b2a22ed54dd4546ea689
Log: Fix bug #64172
 [2016-07-20 11:35 UTC] davey@php.net
Automatic comment on behalf of daniel.persson@textalk.se
Revision: http://git.php.net/?p=php-src.git;a=commit;h=307c1f6bf0e8e3c97416b2a22ed54dd4546ea689
Log: Fix bug #64172
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 10 22:01:28 2024 UTC