-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
compare version using PHP_VERSION_ID #12497
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
Conversation
I modified the changes from #12372 as suggested by @stof. However, there are much more calls to |
@xabbuh Looks like a good idea to me. |
Indeed, it is a good idea to change this everywhere |
9c322b9
to
6f6ddf3
Compare
It's updated now. I hope I didn't mess anything up. |
I was not sure how to replace something like this: version_compare(PHP_VERSION, '5.5.0-dev', '>=') Is |
@xabbuh yes. Unreleased versions on 5.5.0 were already using the 50500 id (this id constant does not take pre-release versions into account) |
@@ -30,7 +30,7 @@ public function testRoutingErrorIsNotExposedForProtectedResourceWhenAnonymous($c | |||
*/ | |||
public function testRoutingErrorIsExposedWhenNotProtected($config) | |||
{ | |||
if (strpos(PHP_OS, "WIN") === 0 && version_compare(phpversion(), "5.3.9", "<")) { | |||
if (strpos(PHP_OS, "WIN") === 0 && PHP_VERSION_ID < 50309) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strpos(PHP_OS, "WIN") === 0
should be changed to defined('PHP_WINDOWS_VERSION_BUILD')
to be consistent with all other windows detection done in Symfony
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense
To let opcode caches optimize cached code, the `PHP_VERSION_ID` constant is used to detect the current PHP version instead of calling `version_compare()` with `PHP_VERSION`.
6f6ddf3
to
367ed3c
Compare
Should be good now. |
@@ -49,7 +49,7 @@ public function testGenerateCsrfTokenOnUnstartedSession() | |||
{ | |||
session_id('touti'); | |||
|
|||
if (!version_compare(PHP_VERSION, '5.4', '>=')) { | |||
if (PHP_VERSION_ID < 50400) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't mean >= ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pborreli no. there was a negation before the version_compare
👍 |
👍 thanks @xabbuh |
Thank you @xabbuh. |
This PR was merged into the 2.3 branch. Discussion ---------- compare version using PHP_VERSION_ID | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | To let opcode caches optimize cached code, the `PHP_VERSION_ID` constant is used to detect the current PHP version instead of calling `version_compare()` with `PHP_VERSION`. Commits ------- 367ed3c compare version using PHP_VERSION_ID
This continues the work started in symfony#12497 on the `2.3` branch.
@xabbuh do you have any background/docs on this? |
The first advantage is that this removes a function call:
And depending on the configuration of
|
This PR was merged into the 2.5 branch. Discussion ---------- compare version using PHP_VERSION_ID | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This continues the work started in #12497 on the `2.3` branch. Commits ------- d2f846b compare version using PHP_VERSION_ID
To let opcode caches optimize cached code, the
PHP_VERSION_ID
constant is used to detect the current PHP version instead of calling
version_compare()
withPHP_VERSION
.