Bug #94709
closedTypeError for SQLite in DB Compare
100%
Description
The following error id displayed to the user within Backend Maintenance module when doing a DB compare with sqlite database. I've an old v10 updated to current master and trying to execute db compare.
(1/1) TypeError Argument 2 passed to Doctrine\DBAL\Connection::handleExceptionDuringQuery() must be of the type string, array given, called in /home/daniels/Projects/own/website-typo3/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php on line 1524
The issue seems to be within TYPO3\CMS\Core\Database\Schema\SchemaMigrator::migrate which generates arrays instead of strings of SQL for SQLite.
$updateSuggestionsPerConnection = array_merge_recursive( $this->getUpdateSuggestions($statements), $this->getUpdateSuggestions($statements, true) );
Contains the issue, some SQL exists in both and is combined as new array containing duplicates.
at Doctrine\DBAL\Connection->handleExceptionDuringQuery() in /home/daniels/Projects/own/website-typo3/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 1524 $result = $connection->exec($sql); } } catch (Throwable $e) { $this->handleExceptionDuringQuery( $e, $sql, $params, $types ); at Doctrine\DBAL\Connection->executeStatement() in /home/daniels/Projects/own/website-typo3/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php line 1473 'https://github.com/doctrine/dbal/pull/4163', 'Connection::executeUpdate() is deprecated, use Connection::executeStatement() instead.' ); return $this->executeStatement($sql, $params, $types); } /** * Executes an SQL statement with the given parameters and returns the number of affected rows. at Doctrine\DBAL\Connection->executeUpdate() in /home/daniels/Projects/own/website-typo3/project/public/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php line 142 $connection = $connectionPool->getConnectionByName($connectionName); foreach ($statementsToExecute as $hash => $statement) { try { $connection->executeUpdate($statement); } catch (DBALException $e) { $result[$hash] = $e->getPrevious()->getMessage(); } }
Updated by Daniel Siepmann about 3 years ago
- Related to Bug #94710: Database Compare "Change fields" with SQLite shows red error added
Updated by Daniel Siepmann about 3 years ago
Possible hotfix:
diff --git a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php index 6bd668ea51..618ebd43ae 100644 --- a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php +++ b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php @@ -138,6 +138,9 @@ class SchemaMigrator $connection = $connectionPool->getConnectionByName($connectionName); foreach ($statementsToExecute as $hash => $statement) { try { + if (is_array($statement)) { + $statement = $statement[0]; + } $connection->executeUpdate($statement); } catch (DBALException $e) { $result[$hash] = $e->getPrevious()->getMessage();
Which is dirty and doesn't fix the issue, just the consequence.
Updated by Daniel Siepmann about 3 years ago
- Related to Bug #90754: Database Compare with SQLite can not be finished added
Updated by Oliver Hader about 3 years ago
Is this misbehavior present in TYPO3 v10 as well (I guess it is not)?
Updated by Gerrit Code Review about 3 years ago
- Status changed from Accepted to Under Review
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70201
Updated by Simon Gilli about 3 years ago
@olly this behavior was since the introduction of the SchemaMigrator 5 years ago. My patch should fix this issue.
Updated by Daniel Siepmann about 3 years ago
Never encountered the issue while using v10 with sqlite.
Updated by Gerrit Code Review about 3 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70201
Updated by Gerrit Code Review about 3 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70201
Updated by Gerrit Code Review about 3 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/70201
Updated by Simon Gilli about 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset ff06d679850fc651da4cd562c916bd8f4d72d2f8.
Updated by Benni Mack almost 3 years ago
- Status changed from Resolved to Closed