Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23026

ezpublish.yml Database settings must have charset: utf8 if php version is 5.3.6 or lower

    XMLWordPrintable

Details

    • 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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 30 minutes
                6h 30m