utf8mb4 is used by concrete5 8.5.2 by default? why problems with session? is it in in utf8?

Permalink
Hi,
I have concrete5 8.5.2 freshly installed on an database with collation set to utf8mb4_unicode_520_ci, the c5 installer (not through composer or something, just downloaded the most recent version, uploaded it, and followed the wizzard) made the tables, and set them to utf8mb4_unicode_ci.

Now the errors get flooded by these errors:

Exception Occurred: /home/[websitefolder]/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:107 SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x8E, ...' for column 'sessionValue' at row 1 (0)

and in the ssl-error log i see:

[Mon Apr 27 02:46:25.377577 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\\x8E,    ...' for column 'sessionValue' at row 1 in /home/[websitepath]/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105, referer: https://www.[websitepath]/index.php?cID=1&ctask=check-out&ccm_token=1587926350:64d3840c66aa64963cb1e21f0f96d3d9
    .
[Mon Apr 27 02:46:25.377649 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] Stack trace:, referer: https://www.[websitepath]/index.php?cID=1&ctask=check-out&ccm_token=1587926350:64d3840c66aa64963cb1e21f0f96d3d9
    .
[Mon Apr 27 02:46:25.377764 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] #0 /home/[websitepath]/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL), referer:https://www.[websitepath]/index.php?cID=1&ctask=check-out&cc...
    .
[Mon Apr 27 02:46:25.377898 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] #1 /home/[websitepath]/concrete/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php(332): Doctrine\\DBAL\\Driver\\PDOStatement->execute(), referer:https://www.[websitepath]/index.php?cID=1&ctask=check-out&cc...
    .
[Mon Apr 27 02:46:25.378106 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] #2 /home/[websitepath]/concrete/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php(123): Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler->doWrite('01c40986a34b1a5...', '\\x00\\x00\\x00\\x02\\x14\\x03\\x11\\x0F_sf2_at...'), referer:https://www.[websitepath]/index.php?cID=1&ctask=check-out&cc...
    .
[Mon Apr 27 02:46:25.378284 2020] [:error] [pid 14090:tid 139720229172992] [client xxxx] #3 /home/[websitepath]/concrete/vendor/sym in /home/[websitepath]/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 107, referer:https://www.[websitepath]/index.php?cID=1&ctask=check-out&cc...

now my hoster thinks this is because of these collation settings doesn't match with the website code. But in the config of the DB i just see:

'character_set' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',

So that seems good right?

Or there is an invalid utf8 string in that session string. maybe from dutch translation files? maybe from fruitfull theme?

Anyone any idea what's wrong here?

Bart

 
VolgensBartjes replied on at Permalink Reply
it seems that the symfony session handler combined with the pdo drivers that are run by the concrete database settings, doesn't handle the collation well?

The web hoster saw that on itself concrete5 8.5.2 didn't pass the collation to the connection. That was solved by adding the driverOptions to application/config/database.php, but didn't solve the errors:

/**
 * -----------------------------------------------------------------------------
 * Generated 2020-03-06T19:13:23+00:00
 *
 * DO NOT EDIT THIS FILE DIRECTLY
 *
 * @item      connections.concrete
 * @group     database
 * @namespace null
 * -----------------------------------------------------------------------------
 */
return [
    'default-connection' => 'concrete',
    'connections' => [
        'concrete' => [


by changing the sessions from database to file it's solved:
https://www.concrete5.org/community/forums/customizing_c5/how-to-cha...

but the problem remains that when using DB sessions, there are collation errors?

it seems that the refreshCharactersetCollation function at concrete/src/Database/Connection/Connection.php is not called without adding it to your config?

and after adding it to the config, the problem is still there that your sessions could not be added to the DB?