Bug #54478 [Opn->Csd]: The pdo_pgsql specific implementation of inTransaction doesn't work as expected
Edit report at http://bugs.php.net/bug.php?id=54478&edit=1
ID: 54478
Updated by: iliaa@php.net
Reported by: phofstetter at sensational dot ch
Summary: The pdo_pgsql specific implementation of
inTransaction doesn't work as expected
-Status: Open
+Status: Closed
Type: Bug
Package: PDO related
Operating System: OSX, Linux, likely all
PHP Version: 5.3.6
-Assigned To:
+Assigned To: iliaa
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2011-04-06 15:15:40] phofstetter at sensational dot ch
A bit of investigation revealed that the feature was removed in 300464
http://svn.php.net/viewvc?view=revision&revision=300464
I guess the unit test should be removed too, as well as the note in the
manual
which states "Note that currently only the PostgreSQL driver implements
this
method."
------------------------------------------------------------------------
[2011-04-06 14:59:11] phofstetter at sensational dot ch
Description:
------------
PHP 5.3.3 supposedly brought PDO::inTransaction() with a special
implementation
for PostgreSQL wich uses libpq's PQtransactionStatus instead of internal
bookkeeping.
According to the test attached with the revision where this was added
(is_in_transaction.phpt, revision 300351), inTransaction() is supposed
to return
any of the PGSQL_TRANSACTION_* constants.
Unfortunately that's not the case and inTransaction(), even when used in
conjunction with PostgreSQL only returns boolean and doesn't use the
actual
transaction status of the connection but just returns true or false
depending on
whether PDO::beginTransaction() has been called or not.
PHP's own test runner illustrates the problem, which is why I don't
bother
adding an additional test script - the included is_in_transaction.phpt
is
enough:
http://gcov.php.net/viewer.php?
version=PHP_5_3&func=tests&file=ext%2Fpdo_pgsql%2Ftests%2Fis_in_transaction.phpt
Expected result:
----------------
When running the phpt file, I expect the following output:
Test PDO::PGSQL_TRANSACTION_INTRANS
int(2)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
Test PDO::PGSQL_TRANSACTION_INERROR
int(3)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
Actual result:
--------------
When running the phpt file, I (and PHP's webbased test runner) is
getting
Test PDO::PGSQL_TRANSACTION_INTRANS
int(1)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
Test PDO::PGSQL_TRANSACTION_INERROR
int(1)
Test PDO::PGSQL_TRANSACTION_IDLE
int(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54478&edit=1
Thread (3 messages)