From 5ae08a4dba13d43814c6379ef09677bfaa361b58 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Wed, 28 Dec 2022 18:47:07 +0900 Subject: [PATCH] fixed: CakeFixtureManager::_setupTable() is called outside of transaction Fixed PDOException thrown with the message "There is no active transaction" in PHP 8.0+. SQL like CREATE/DROP/TRUNCATE TABLE implicitly commits just before. In PHP 8.0+, calling commit/rollback afterwards will now throw a PDOException. --- lib/Cake/TestSuite/Fixture/CakeFixtureManager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php b/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php index 31808c647..f671713b1 100644 --- a/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php +++ b/lib/Cake/TestSuite/Fixture/CakeFixtureManager.php @@ -229,8 +229,8 @@ class CakeFixtureManager { if (!empty($this->_loaded[$f])) { $fixture = $this->_loaded[$f]; $db = ConnectionManager::getDataSource($fixture->useDbConfig); - $db->begin(); $this->_setupTable($fixture, $db, $test->dropTables); + $db->begin(); $fixture->insert($db); $db->commit(); }