|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-11-24 16:45 UTC] danack@php.net
-Status: Open
+Status: Feedback
[2020-11-24 16:45 UTC] danack@php.net
[2020-11-24 17:01 UTC] smissot at gmail dot com
-Status: Feedback
+Status: Open
[2020-11-24 17:01 UTC] smissot at gmail dot com
[2020-11-24 17:11 UTC] nikic@php.net
[2020-11-25 16:20 UTC] smissot at gmail dot com
-Summary: PDO closes active transaction after $stmt->execute()
+Summary: PDO->inTransaction return false after
$stmt->execute() in 8.0
-Status: Open
+Status: Closed
[2020-11-25 16:20 UTC] smissot at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 07:00:01 2025 UTC |
Description: ------------ PHP 8.0.0RC5 (cli) (built: Nov 19 2020 19:38:09) ( NTS ) MariaDB Version: 10.5.6-MariaDB-1:10.5.6+maria~focal When executing a PDO statement, inTransaction() returns false afterwards. This was not the case in PHP7.4 and before. Once I tested our application on PHP8.0RC5 I encountered this issue. I am using ATTR_EMULATE_PREPARES as we have other issues when this is turned off. In our application, we do have nested transactions due to Laravel s testing framework, so this issue may be related to this. Test script: --------------- // SQL Query grabbed from mysql.general_log that is executed by both 7.4 and 8.0RC5 CALL myProcedure('2') // Prepare $pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); $stmt = $pdo->prepare('CALL myProcedure(?);', [\PDO::ATTR_CURSOR => \PDO::CURSOR_SCROLL]); $stmt->bindValue(1, '2'); // 7.4 dump($pdo->inTransaction()); // true $exec = $stmt->execute(); dump($pdo->inTransaction()); // true // 8.0RC5 dump($pdo->inTransaction()); // true $exec = $stmt->execute(); dump($pdo->inTransaction()); // false Expected result: ---------------- true true Actual result: -------------- true false