Details
-
Bug
-
Resolution: Invalid
-
High
-
5.2, 5.3
-
Castor Core S1, Castor Core S2, Castor Core S3
Description
As explained in eZ/Publish/Core/Persistence/Legacy/EzcDbHandler.php:
PDOMySQL ignores the "charset" param until PHP 5.3.6.
We then need to force it to use an init command.
@link http://php.net/manual/en/ref.pdo-mysql.connection.php
public static function create( $dbParams ) ... $databaseType = $dbParams['type']; if ( $databaseType === 'mysql' && $dbParams['charset'] === 'utf8' ) { $dbParams['driver-opts'] += array( \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', ); }
The problem is the SET NAMES utf8 will only be execute if the database settings in ezpublish.yml has the charset: uf8 line, what it doesn't by default.
It's important that the documentation is clear that, if PHP versions prior than PHP 5.3.6 are used, the charset: uf8 line must be used as well in the database settings to avoid charset problems.