Bug #63343 [Opn->Ver]: Commit failure for repeated transactions on repeated PDO persistent conn

From: Date: Wed, 31 Aug 2016 23:31:08 +0000
Subject: Bug #63343 [Opn->Ver]: Commit failure for repeated transactions on repeated PDO persistent conn
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203712@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63343&edit=1

 ID:                 63343
 Updated by:         cmb@php.net
 Reported by:        brn at macrovita dot com dot br
-Summary:            SQLITE: Commit failure for repeated transactions on
                     repeated PDO persistent conn
+Summary:            Commit failure for repeated transactions on repeated
                     PDO persistent conn
-Status:             Open
+Status:             Verified
 Type:               Bug
 Package:            PDO Core
 Operating System:   Mixed
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Confirmed: <https://3v4l.org/iTsHt>.


Previous Comments:
------------------------------------------------------------------------
[2014-12-17 19:51:42] brn at macrovita dot com dot br

Note: This bug is NOT specific to SQLite.

The original test case uses SQLite just because it makes it simpler to reproduce the problem.

Originally, we ran into this bug with connections against MySQL.

------------------------------------------------------------------------
[2012-10-24 00:06:25] brn at macrovita dot com dot br

Description:
------------
Repeated transaction on repeated persistent PDO connection fails on commit with 
'There is no active transaction'.

Reproduced on:
- Fedora 14 32bit PHP 5.3.6 
- Gentoo 64bit PHP 5.3.14

We'll work around the bug in application code, but we thought developers might 
like to know about this.

// BTM5282

Test script:
---------------
# Should work, but does not:
cat <<'EOD' | php -d display_errors=1 && echo OK
<?php
$db = new PDO('sqlite::memory:', '', '', array(PDO::ATTR_PERSISTENT
=> true));
$db->beginTransaction();
$st = $db->query('select 1');
echo $st->fetchColumn()."\n";
$db->commit();
//$st = null;
$db = new PDO('sqlite::memory:', '', '', array(PDO::ATTR_PERSISTENT
=> true));
$db->beginTransaction();
$st = $db->query('select 2');
echo $st->fetchColumn()."\n";
$db->commit();
EOD
# INTERESTING? -> Works OK with uncommented $st = null;
# Works OK with PDO::ATTR_PERSISTENT => false .

Expected result:
----------------
1
2
OK

Actual result:
--------------
Fatal error: Uncaught exception 'PDOException' 
with message 'There is no active transaction' in -:11 ...


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=63343&edit=1


Thread (9 messages)

« previous php.bugs (#203712) next »