From b0ef53e4ee47a7e4816f548df3f9e0ba97156a31 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Wed, 30 Jun 2021 12:50:21 +0200 Subject: [PATCH] [BUGFIX] PHP 8 warnings from installer Some rather obvious sanitation around TYPO3 installation procedure. Resolves: #94443 Releases: master Change-Id: Icb358cafbf6216d436358b7b45273f907deba721 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69670 Tested-by: core-ci <typo3@b13.com> Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: Jochen <rothjochen@gmail.com> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Oliver Bartsch <bo@cedev.de> Reviewed-by: Jochen <rothjochen@gmail.com> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../install/Classes/Controller/InstallerController.php | 8 ++++---- typo3/sysext/install/Classes/Middleware/Installer.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/install/Classes/Controller/InstallerController.php b/typo3/sysext/install/Classes/Controller/InstallerController.php index 1625918b4d1e..7eee2b5f39b5 100644 --- a/typo3/sysext/install/Classes/Controller/InstallerController.php +++ b/typo3/sysext/install/Classes/Controller/InstallerController.php @@ -379,8 +379,8 @@ class InstallerController 'socket' => $this->getDatabaseConfiguredMysqliSocket(), ] ); - if ($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['driver'] === 'mysqli' - && $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['host'] === 'localhost') { + if (($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['driver'] ?? '') === 'mysqli' + && ($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['host'] ?? '') === 'localhost') { $activeAvailableOption = 'mysqliSocketManualConfiguration'; } } @@ -627,8 +627,8 @@ class InstallerController public function checkDatabaseSelectAction(): ResponseInterface { $success = false; - if ((string)$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['dbname'] !== '' - || (string)$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['path'] !== '' + if ((string)($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['dbname'] ?? '') !== '' + || (string)($GLOBALS['TYPO3_CONF_VARS']['DB']['Connections'][ConnectionPool::DEFAULT_CONNECTION_NAME]['path'] ?? '') !== '' ) { try { $success = GeneralUtility::makeInstance(ConnectionPool::class) diff --git a/typo3/sysext/install/Classes/Middleware/Installer.php b/typo3/sysext/install/Classes/Middleware/Installer.php index e008a11d6c7f..9dd24ec66a03 100644 --- a/typo3/sysext/install/Classes/Middleware/Installer.php +++ b/typo3/sysext/install/Classes/Middleware/Installer.php @@ -87,7 +87,7 @@ class Installer implements MiddlewareInterface if ($session->isExpired()) { $session->refreshSession(); } - $postValues = $request->getParsedBody()['install']; + $postValues = $request->getParsedBody()['install'] ?? []; $sessionTokenOk = false; if (empty($postValues)) { // No post data is there, no token check necessary -- GitLab