Bug #80871 [Opn->Csd]: PDO::inTransactional() always return false (Yii2)
| From: | sevak754 at gmail dot com | Date: | Mon, 19 Apr 2021 13:55:50 +0000 |
| Subject: | Bug #80871 [Opn->Csd]: PDO::inTransactional() always return false (Yii2) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233510@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80871&edit=1
ID: 80871
User updated by: sevak754 at gmail dot com
Reported by: sevak754 at gmail dot com
Summary: PDO::inTransactional() always return false (Yii2)
-Status: Open
+Status: Closed
Type: Bug
Package: PDO DBlib
Operating System: Linux
PHP Version: 8.0.3
Block user comment: N
Private report: N
New Comment:
This bug appeared after this bugfix: https://github.com/yiisoft/yii2/pull/18481 ,
cause I'd driverName => 'mssql' instead of 'dblib'. When I changed this
property to 'dblib', transactions started to work correctly
Previous Comments:
------------------------------------------------------------------------
[2021-04-13 14:19:01] nikic@php.net
PDO DBlib uses PDOs transaction state emulation. I looked through the code, but didn't spot any
obvious issues. I can't test this driver myself.
------------------------------------------------------------------------
[2021-04-13 13:58:43] menschov dot evgeny at yandex dot ru
Are there any chances of fixing this problem?
------------------------------------------------------------------------
[2021-03-17 06:58:03] sevak754 at gmail dot com
Yes, DBLIB version 7.2
------------------------------------------------------------------------
[2021-03-16 08:46:55] nikic@php.net
When you say you use MSSQL, does that mean you use the PDO DBLIB driver?
------------------------------------------------------------------------
[2021-03-16 08:39:41] sevak754 at gmail dot com
Description:
------------
I've tried to begin transaction with Yii2, but it didn't commit. It happened because here
yiisoft/yii2/db/Transaction.php:168 is PDO::inTransactional() check and he always return false. This
problem appeared after update to php 8.
I use MSSQL and I think there is a problem with driver.
Test script:
---------------
if ($this->_level === 0) {
Yii::debug('Commit transaction', __METHOD__);
// make sure the transaction wasn't autocommitted
if ($this->db->pdo->inTransaction()) { // always false
$this->db->pdo->commit();
}
$this->db->trigger(Connection::EVENT_COMMIT_TRANSACTION);
return;
}
Expected result:
----------------
Transaction has been commited
Actual result:
--------------
Transaction has been rollbacked
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80871&edit=1