Skip to content

Server version should be specified as a string #9445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2018

Conversation

kalifg
Copy link
Contributor

@kalifg kalifg commented Mar 15, 2018

If the server version is specified without quotes like this:

    server_version: 5.6

The resulting compiled container will contain the value

->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 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.
Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kalifg this is a very nice improvement ... and a great first contribution to Symfony Docs. I reworded it a bit to make the explanation more concise, but your original description was great. Thanks!

@javiereguiluz javiereguiluz added this to the 2.7 milestone Mar 18, 2018
@javiereguiluz javiereguiluz merged commit f525f75 into symfony:2.7 Mar 18, 2018
javiereguiluz added a commit that referenced this pull request Mar 18, 2018
…aviereguiluz)

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
@kalifg kalifg deleted the patch-2 branch March 21, 2018 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants