Skip to content
Snippets Groups Projects
Commit 9cefc0a5 authored by Susanne Moog's avatar Susanne Moog Committed by Christian Kuhn
Browse files

[BUGFIX] UpgradeWizard check for utf8 is wrong

The upgrade wizard checking for utf-8 sets a
variable called charsetOk which worked
differently on MySQL compared to other DBMS.

On MySQL it contained true if the charset was
not OK, in all other cases it was true if ok.

This is now consistently handled according to
the variable name.

Change-Id: Iee347b6c2469ad9a33e9bd4109d361dc337a63a0
Resolves: #83141
Releases: master
Reviewed-on: https://review.typo3.org/54835


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: default avatarMathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent bd606fda
Branches
Tags
No related merge requests found
......@@ -835,7 +835,7 @@ class UpgradeController extends AbstractController
public function upgradeWizardsBlockingDatabaseCharsetTestAction(): ResponseInterface
{
$upgradeWizardsService = new UpgradeWizardsService();
$result = $upgradeWizardsService->isDatabaseCharsetUtf8();
$result = !$upgradeWizardsService->isDatabaseCharsetUtf8();
return new JsonResponse([
'success' => true,
'needsUpdate' => $result,
......
......@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Service;
* The TYPO3 project - inspiring people to share!
*/
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
use TYPO3\CMS\Core\Cache\DatabaseSchemaService;
......@@ -210,9 +211,11 @@ class UpgradeWizardsService
*/
public function isDatabaseCharsetUtf8(): bool
{
/** @var \TYPO3\CMS\Core\Database\Connection $connection */
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
$isDefaultConnectionMysql = strpos($connection->getServerVersion(), 'MySQL') === 0;
$isDefaultConnectionMysql = ($connection->getDatabasePlatform() instanceof MySqlPlatform);
if (!$isDefaultConnectionMysql) {
// Not tested on non mysql
......@@ -231,7 +234,7 @@ class UpgradeWizardsService
->execute()
->fetchColumn();
// check if database charset is utf-8, also allows utf8mb4
$charsetOk = strpos($charset, 'utf8') !== 0;
$charsetOk = strpos($charset, 'utf8') === 0;
}
return $charsetOk;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment