From 219a6882ed034fb70a4fb430e910348ee3ba4dc6 Mon Sep 17 00:00:00 2001 From: Thomas Hohn <thomas@hohn.dk> Date: Sun, 26 Feb 2017 16:05:33 +0100 Subject: [PATCH] [BUGFIX] Uncaught exception in Install tool Fixes an uncaught exception in the Install tool if the file ext_tables_static+adt.sql contains invalid CREATE TABLE statements. Resolves: #80025 Releases: master Change-Id: I8417b34c944f359feb16f5e44277b61fb289eea1 Reviewed-on: https://review.typo3.org/51861 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Markus Klein <markus.klein@typo3.org> Tested-by: Markus Klein <markus.klein@typo3.org> --- .../Classes/Database/Schema/SchemaMigrator.php | 2 +- .../Controller/Action/Step/DatabaseData.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php index 81c9a162ba4d..88c193e7ffae 100644 --- a/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php +++ b/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php @@ -260,7 +260,7 @@ class SchemaMigrator } catch (StatementException $statementException) { // Enrich the error message with the full invalid statement throw new StatementException( - $statementException->getMessage() . ' in statement ' . $statement, + $statementException->getMessage() . ' in statement: ' . LF . $statement, 1476171315, $statementException ); diff --git a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php index 60deb489d5be..7099ce7dc91a 100644 --- a/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php +++ b/typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php @@ -17,6 +17,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step; use Doctrine\DBAL\DBALException; use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Database\Schema\Exception\StatementException; use TYPO3\CMS\Core\Database\Schema\SchemaMigrator; use TYPO3\CMS\Core\Database\Schema\SqlReader; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -61,8 +62,19 @@ class DatabaseData extends AbstractStepAction $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $postValues['sitename']); } - $result = $this->importDatabaseData(); - if (!empty($result)) { + try { + $result = $this->importDatabaseData(); + if (!empty($result)) { + return $result; + } + } catch (StatementException $exception) { + $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class); + $errorStatus->setTitle('Import of database data could not be performed'); + $errorStatus->setMessage( + 'Error detected in SQL statement:' . LF . + $exception->getMessage() + ); + $result[] = $errorStatus; return $result; } -- GitLab