|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-03-31 20:31 UTC] levim@php.net
[2021-03-31 20:39 UTC] danack@php.net
[2021-03-31 20:48 UTC] pau dot ferran dot grau at gmail dot com
[2021-03-31 20:54 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
[2021-03-31 20:54 UTC] nikic@php.net
[2021-03-31 21:21 UTC] pau dot ferran dot grau at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 04:00:01 2025 UTC |
Description: ------------ when I begin a transaction and I try lock a table then pdo throw the exception with the message: There is no active transaction. I use a MySQL 5.7.20 Test script: --------------- try { $dbh = new \PDO('mysql:host=127.0.0.1;port=3309;dbname=event_sourcing_test', 'root', null); $dbh->beginTransaction(); $dbh->exec('LOCK TABLE test WRITE'); $dbh->exec("INSERT INTO test (id) VALUES ('a')"); $dbh->commit(); $dbh->exec('UNLOCK TABLES'); } catch (\PDOException $e) { echo $e->getMessage() . PHP_EOL; //There is no active transaction } Expected result: ---------------- Pdo doesn't throw an exception Actual result: -------------- Pdo throws an exception PDOException Object ( [message:protected] => There is no active transaction [string:Exception:private] => [code:protected] => 0 [file:protected] => /Users/pau/Projects/apps/event-sourcing/test.php [line:protected] => 10 [trace:Exception:private] => Array ( [0] => Array ( [file] => /Users/pau/Projects/apps/event-sourcing/test.php [line] => 10 [function] => commit [class] => PDO [type] => -> [args] => Array ( ) ) ) [previous:Exception:private] => [errorInfo] => )