4

After updating DDEV to 1.19 I get following error after backend login in TYPO3 11.5.8:

PHP Warning: gzuncompress(): need dictionary in /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php line 158

I already tried a lot of things:

I have tried all officially PHP versions which are possible with DDEV.

I have downgraded doctrine/dbal 2.13.8, 2.13.7, 2.13.6, ...

I have downgraded MariaDB 10.3 to 10.2

Nothing works. So it needs a deeper view of the problem:

In Typo3DatabaseBackend.php at line 158 I have added

$tmp = gzuncompress($data);

With help of xdebug I can see that uncompress works without any problems. So, IMO it can't be a zlib problem.

As next step I have converted the compressed $data with bin2hex($data) into $tmp and in my database I have tried to HEX the value, too:

SELECT uid, CONVERT(content USING utf8) FROM cache_rootline WHERE uid = 1;

Interesting point:

  • Before: 789c4d904172c3200
  • In DB: 0x783f4d3f41723f200
  • Select: 783f4d3f41723f200

Nearly each 2nd byte is correct, but the other bytes are totally wrong.

I have exported my MariaDB data and switched to MySQL 8.0 and imported the data again. Because of some utf8mb4_unicode_ci incompatibilities I have recreated all cache tables with help of Installtool of TYPO3.

After login to TYPO3 backend I got following error:

General error: 3988 Conversion from collation utf8_general_ci into utf8mb4_unicode_ci impossible

I have searched full TYPO3 project, but I can't find utf8_general_ci anywhere.

Do you have any idea, what could be wrong?

Thank you for your help.

Stefan

2 Answers2

3

On new DDEV project four LocalConfiguration looks something like that:

'DB' => [
    'Connections' => [
        'Default' => [
            'charset' => 'utf8',
            'driver' => 'mysqli',
        ],
    ],
],

and DDEV creates following to your AdditionalConfiguration.php

'DB' => [
    'Connections' => [
        'Default' => [
            'dbname' => 'db',
            'driver' => 'pdo_mysql',
            'host' => 'db',
            'password' => 'db',
            'port' => '3306',
            'user' => 'db',
        ],
    ],
],

Maybe you have added following to your configuration to create new tables with a specific collation:

'DB' => [
    'Connections' => [
        'Default' => [
            ...
            'tableoptions' => [
                'charset' => 'utf8mb4',
                'collate' => 'utf8mb4_general_ci',
            ],
        ],
    ],
],

Do you see the problem? The charset option of LocalConfiguration.php was NOT overwritten in your AdditionalConfiguration. So, you have a charset miss-match in your configuration. Please keep them in sync.

Either set collation back to utf8_unicode_ci or add:

'charset' => 'utf8mb4',

in AdditionalConfiguration.php

Have fun with TYPO3

Stefan

  • 1
    Pretty baffling. Do you think DDEV should add the utf8mb4 charset by default (it does with Drupal settings). Possibly related, https://stackoverflow.com/questions/27692527/why-phps-gzuncompress-function-can-go-wrong – rfay Mar 17 '22 at 11:58
  • I didn't understand what this had to do with ddev v1.19 or mysql 8.0. Are you on amd64 or arm64? On amd64? Note that both ddev v1.18.2 and v1.19.0 with mysql 8.0 use the same version, 8.0.26. – rfay Mar 17 '22 at 12:32
  • 1
    Ehm,...LocalConfiguration.php `['DB'][ 'Connections'][ 'Default']['charset']`should *not* be set to 'utf8' by default (https://github.com/TYPO3/typo3/blob/main/typo3/sysext/install/Classes/Controller/InstallerController.php#L593). But, yes, in a fresh installation my LocaclConfiguration looks the same.... – Julian Hofmann Mar 17 '22 at 23:01
  • @rfay If you want to set "charset" to "utf8mb4" you should also set the both tableoptions accordingly in AdditionalConfiguration.php. See this link https://github.com/TYPO3/typo3/blob/main/typo3/sysext/install/Classes/Controller/InstallerController.php#L593 (THX Julian) – Stefan Frömken Mar 21 '22 at 07:01
  • @rfay In my LocalConfiguration.php the driver is "mysqli", but in AdditionalConfiguration.php the driver is "pdo_mysql". I'm pretty sure that I have not set this driver. Have you changed that behavior in one of the last ddev updates? – Stefan Frömken Mar 21 '22 at 07:09
  • 2
    Before v1.19, the driver was not set, but in v1.19 ddev supports Postgresql as well, so the driver is set. Here is the comparison of the v1.18.2 and v1.19 generated AdditionalConfiguration.php. https://gist.github.com/rfay/717c272aab729648619c839dcfa049c3 - Note that if it has the original "#ddev-generated" on the top of the file, ddev overwrites it on each start. – rfay Mar 22 '22 at 12:34
  • I think https://github.com/drud/ddev/pull/3734 will solve this. – rfay Mar 28 '22 at 13:40
  • Setting 'charset' => 'utf8mb4' in AdditionalConfiguration.php works fine for me, but this file is overwritten at each restart of ddev per default and per recommendation. Of course this can be suppressed by removing #ddev-generated but is this really a solution? – Robert Hufsky Apr 13 '22 at 10:07
2

For me the easiest way was to replace the pdo_mysql driver with mysqli. Because I'm only using MariaDB and my database was utf8_general_ci encoded, this was the easiest fix/help.