Skip to content

Commit 2afde20

Browse files
committed
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()` with `PHP_VERSION`.
1 parent c1e4dbf commit 2afde20

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Fragment/HIncludeFragmentRenderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function render($uri, Request $request, array $options = array())
107107
}
108108
$renderedAttributes = '';
109109
if (count($attributes) > 0) {
110-
if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
110+
if (PHP_VERSION_ID >= 50400) {
111111
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
112112
} else {
113113
$flags = ENT_QUOTES;

Tests/Controller/ControllerResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function testGetArguments()
188188
$request->attributes->set('foobar', 'foobar');
189189
$controller = array(new self(), 'controllerMethod3');
190190

191-
if (version_compare(PHP_VERSION, '5.3.16', '==')) {
191+
if (PHP_VERSION_ID === 50316) {
192192
$this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system');
193193
} else {
194194
try {

0 commit comments

Comments
 (0)