Bug #80410 [Fbk->Opn]: PDO closes active transaction after $stmt->execute()

From: Date: Tue, 24 Nov 2020 17:01:56 +0000
Subject: Bug #80410 [Fbk->Opn]: PDO closes active transaction after $stmt->execute()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230590@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80410&edit=1 ID: 80410 User updated by: smissot at gmail dot com Reported by: smissot at gmail dot com Summary: PDO closes active transaction after $stmt->execute() -Status: Feedback +Status: Open Type: Bug Package: PDO MySQL Operating System: Debian PHP Version: 8.0.0RC5 Block user comment: N Private report: N New Comment: Of course! I will need some time to strip this down to a reproduceable piece, once I have it I will report back here. Previous Comments: ------------------------------------------------------------------------ [2020-11-24 16:45:13] danack@php.net > 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. Well, my spidey sense is tingling. That sounds a whole lot like you are dependent on some edge-case condition if using ATTR_EMULATE_PREPARES makes it 'work'. If you want someone to look at this, please can you spend the effort to extract a reproduce case? I highly doubt anyone is going to be able to investigate this issue, even if they wanted to, without that as no-one would even know where to start looking. ------------------------------------------------------------------------ [2020-11-24 16:33:07] smissot at gmail dot com 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80410&edit=1

« previous php.bugs (#230590) next »