Skip to content

Commit 330ce77

Browse files
committed
minor #9445 Server version should be specified as a string (kalifg, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- 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. <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> Commits ------- f525f75 Minor reword 8e50933 Server version should be specified as a string
2 parents b0b2def + f525f75 commit 330ce77

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reference/configuration/doctrine.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ The following block shows all possible configuration keys:
312312
charset: UTF8
313313
logging: '%kernel.debug%'
314314
platform_service: MyOwnDatabasePlatformService
315-
server_version: 5.6
315+
server_version: '5.6'
316316
mapping_types:
317317
enum: string
318318
types:
@@ -362,6 +362,11 @@ The following block shows all possible configuration keys:
362362
your database server version (use ``postgres -V`` or ``psql -V`` command
363363
to find your PostgreSQL version and ``mysql -V`` to get your MySQL
364364
version).
365+
366+
Always wrap the server version number with quotes to parse it as a string
367+
instead of a float number. Otherwise, the floating-point representation
368+
issues can make your version be considered a different number (e.g. ``5.6``
369+
will be rounded as ``5.5999999999999996447286321199499070644378662109375``).
365370

366371
If you don't define this option and you haven't created your database
367372
yet, you may get ``PDOException`` errors because Doctrine will try to

0 commit comments

Comments
 (0)