From 8e50933f9e1ef7a29758f82b79790062d42067ca Mon Sep 17 00:00:00 2001 From: Michael Dwyer Date: Thu, 15 Mar 2018 11:06:30 -0500 Subject: [PATCH 1/2] Server version should be specified as a string If the server version is specified without quotes like this: ```yml server_version: 5.6 ``` The resulting compiled container will contain the value ```php ->createConnection( ... 'serverVersion' => 5.5999999999999996447286321199499070644378662109375, ... ) ``` This is a result of floating-point representation issues. Quoting the value will avoid that and will deliver the string `'5.6'` to the `version_compare` function, as it's expecting. --- reference/configuration/doctrine.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index c7961233a5d..6b3709c41bd 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -312,7 +312,7 @@ The following block shows all possible configuration keys: charset: UTF8 logging: '%kernel.debug%' platform_service: MyOwnDatabasePlatformService - server_version: 5.6 + server_version: '5.6' mapping_types: enum: string types: @@ -362,6 +362,13 @@ The following block shows all possible configuration keys: your database server version (use ``postgres -V`` or ``psql -V`` command to find your PostgreSQL version and ``mysql -V`` to get your MySQL version). + + If the server version is specified without quotes (i.e. ``5.6``), then the + resulting compiled container will contain the value ``5.5999999999999996447286321199499070644378662109375``. + + This is a result of floating-point representation issues. Quoting the + value will avoid that and will deliver the string ``'5.6'`` to the + ``version_compare`` function, as it's expecting. If you don't define this option and you haven't created your database yet, you may get ``PDOException`` errors because Doctrine will try to From f525f75b4e2dd0b6bf52fdf01c5a4a8bb2cacdca Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 18 Mar 2018 13:23:33 +0100 Subject: [PATCH 2/2] Minor reword --- reference/configuration/doctrine.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index 6b3709c41bd..185bf971d7d 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -363,12 +363,10 @@ The following block shows all possible configuration keys: to find your PostgreSQL version and ``mysql -V`` to get your MySQL version). - If the server version is specified without quotes (i.e. ``5.6``), then the - resulting compiled container will contain the value ``5.5999999999999996447286321199499070644378662109375``. - - This is a result of floating-point representation issues. Quoting the - value will avoid that and will deliver the string ``'5.6'`` to the - ``version_compare`` function, as it's expecting. + Always wrap the server version number with quotes to parse it as a string + instead of a float number. Otherwise, the floating-point representation + issues can make your version be considered a different number (e.g. ``5.6`` + will be rounded as ``5.5999999999999996447286321199499070644378662109375``). If you don't define this option and you haven't created your database yet, you may get ``PDOException`` errors because Doctrine will try to