Project

General

Profile

Actions

Bug #84180

closed

Default database charset in ConnectionPool is not valid

Added by Philipp Rönsch about 6 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2018-03-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
dbal, connection pool, database, charset, encoding
Complexity:
Is Regression:
Sprint Focus:

Description

When configuring an additional or new database like this:

$connectionParams = [
    'dbname' => '..',
    'user' => '..',
    'password' => '..',
    'host' => '..',
    'driver' => '..'
];
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['..'] =  $connectionParams;

the option 'charset' can be left out without issue of connection.

ConnectionPool will default to a new charset setting, but not a valid one at this line:
https://api.typo3.org/typo3cms/8/html/_connection_pool_8php_source.html#l00146
The charset 'utf-8' is invalid and content loaded from a UTF-8 database like this, will have unknown characters in them, causing issues when the conent is parsed via htmlspecialchars() for example.

As solution, the charset configuration should be required or default to the proper string 'utf8'.

Actions

Also available in: Atom PDF