minor #23021 Using FQ name for PHP_VERSION_ID (fabpot)
This PR was merged into the 2.7 branch.
Discussion
----------
Using FQ name for PHP_VERSION_ID
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #22650, replaces #23000
| License | MIT
| Doc PR | n/a
Commits
-------
f91a020b84
Using FQ name for PHP_VERSION_ID
This commit is contained in:
commit
78c4a5ff43
2
.github/build-packages.php
vendored
2
.github/build-packages.php
vendored
@ -11,7 +11,7 @@ array_shift($dirs);
|
|||||||
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
|
$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs))));
|
||||||
|
|
||||||
$packages = array();
|
$packages = array();
|
||||||
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
|
$flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
|
||||||
|
|
||||||
foreach ($dirs as $k => $dir) {
|
foreach ($dirs as $k => $dir) {
|
||||||
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {
|
if (!system("git diff --name-only $mergeBase -- $dir", $exitStatus)) {
|
||||||
|
2
phpunit
2
phpunit
@ -7,7 +7,7 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
|
|||||||
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
|
echo "Unable to find the `simple-phpunit` script in `vendor/symfony/phpunit-bridge/bin/`.\nPlease run `composer update` before running this command.\n";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
|
if (\PHP_VERSION_ID >= 70000 && !getenv('SYMFONY_PHPUNIT_VERSION')) {
|
||||||
putenv('SYMFONY_PHPUNIT_VERSION=6.0');
|
putenv('SYMFONY_PHPUNIT_VERSION=6.0');
|
||||||
}
|
}
|
||||||
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
putenv('SYMFONY_PHPUNIT_DIR='.__DIR__.'/.phpunit');
|
||||||
|
@ -174,7 +174,7 @@ class CodeExtension extends \Twig_Extension
|
|||||||
$text = "$text at line $line";
|
$text = "$text at line $line";
|
||||||
|
|
||||||
if (false !== $link = $this->getFileLink($file, $line)) {
|
if (false !== $link = $this->getFileLink($file, $line)) {
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||||
} else {
|
} else {
|
||||||
$flags = ENT_QUOTES;
|
$flags = ENT_QUOTES;
|
||||||
|
@ -81,9 +81,9 @@ if ($this->env->isDebug()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EOTXT;
|
EOTXT;
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
|
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
|
||||||
} elseif (PHP_VERSION_ID >= 50400) {
|
} elseif (\PHP_VERSION_ID >= 50400) {
|
||||||
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
|
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
|
||||||
} else {
|
} else {
|
||||||
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);
|
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);
|
||||||
@ -114,9 +114,9 @@ if ($this->env->isDebug()) {
|
|||||||
|
|
||||||
EOTXT;
|
EOTXT;
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
|
$expected = preg_replace('/%(.*?)%/', '($context["$1"] ?? null)', $expected);
|
||||||
} elseif (PHP_VERSION_ID >= 50400) {
|
} elseif (\PHP_VERSION_ID >= 50400) {
|
||||||
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
|
$expected = preg_replace('/%(.*?)%/', '(isset($context["$1"]) ? $context["$1"] : null)', $expected);
|
||||||
} else {
|
} else {
|
||||||
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);
|
$expected = preg_replace('/%(.*?)%/', '$this->getContext($context, "$1")', $expected);
|
||||||
|
@ -67,11 +67,11 @@ class FormThemeTest extends TestCase
|
|||||||
|
|
||||||
protected function getVariableGetter($name)
|
protected function getVariableGetter($name)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,11 +264,11 @@ class SearchAndRenderBlockNodeTest extends TestCase
|
|||||||
|
|
||||||
protected function getVariableGetter($name)
|
protected function getVariableGetter($name)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ class TransNodeTest extends TestCase
|
|||||||
|
|
||||||
protected function getVariableGetterWithoutStrictCheck($name)
|
protected function getVariableGetterWithoutStrictCheck($name)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? null)', $name, $name);
|
return sprintf('($context["%s"] ?? null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,11 +57,11 @@ class TransNodeTest extends TestCase
|
|||||||
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
|
return sprintf('(isset($context["%s"]) || array_key_exists("%s", $context) ? $context["%s"] : (function () { throw new Twig_Error_Runtime(\'Variable "%s" does not exist.\', 0, $this->getSourceContext()); })())', $name, $name, $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
|
return sprintf('($context["%s"] ?? $this->getContext($context, "%s"))', $name, $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
|
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ abstract class ServerCommand extends ContainerAwareCommand
|
|||||||
*/
|
*/
|
||||||
public function isEnabled()
|
public function isEnabled()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
|
if (\PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ class CodeHelper extends Helper
|
|||||||
*/
|
*/
|
||||||
public function formatFile($file, $line, $text = null)
|
public function formatFile($file, $line, $text = null)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||||
} else {
|
} else {
|
||||||
$flags = ENT_QUOTES;
|
$flags = ENT_QUOTES;
|
||||||
|
@ -85,7 +85,7 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
|
|||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
|
$this->parseTokens(token_get_all(file_get_contents($file)), $catalog);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||||
gc_mem_caches();
|
gc_mem_caches();
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,7 @@ REGEX;
|
|||||||
|
|
||||||
$output .= self::compressCode($rawChunk);
|
$output .= self::compressCode($rawChunk);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||||
unset($tokens, $rawChunk);
|
unset($tokens, $rawChunk);
|
||||||
gc_mem_caches();
|
gc_mem_caches();
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\ClassLoader;
|
namespace Symfony\Component\ClassLoader;
|
||||||
|
|
||||||
if (!defined('SYMFONY_TRAIT')) {
|
if (!defined('SYMFONY_TRAIT')) {
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
define('SYMFONY_TRAIT', T_TRAIT);
|
define('SYMFONY_TRAIT', T_TRAIT);
|
||||||
} else {
|
} else {
|
||||||
define('SYMFONY_TRAIT', 0);
|
define('SYMFONY_TRAIT', 0);
|
||||||
@ -72,7 +72,7 @@ class ClassMapGenerator
|
|||||||
|
|
||||||
$classes = self::findClasses($path);
|
$classes = self::findClasses($path);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||||
gc_mem_caches();
|
gc_mem_caches();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class ClassMapGeneratorTest extends TestCase
|
|||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
|
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
|
||||||
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
|
||||||
@ -119,7 +119,7 @@ class ClassMapGeneratorTest extends TestCase
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500) {
|
if (\PHP_VERSION_ID >= 50500) {
|
||||||
$data[] = array(__DIR__.'/Fixtures/php5.5', array(
|
$data[] = array(__DIR__.'/Fixtures/php5.5', array(
|
||||||
'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
|
'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
|
||||||
));
|
));
|
||||||
|
@ -247,7 +247,7 @@ class TextDescriptor extends Descriptor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
|
return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ class ErrorHandler
|
|||||||
$throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
|
$throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID <= 50407 && (PHP_VERSION_ID >= 50400 || PHP_VERSION_ID <= 50317)) {
|
if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
|
||||||
// Exceptions thrown from error handlers are sometimes not caught by the exception
|
// Exceptions thrown from error handlers are sometimes not caught by the exception
|
||||||
// handler and shutdown handlers are bypassed before 5.4.8/5.3.18.
|
// handler and shutdown handlers are bypassed before 5.4.8/5.3.18.
|
||||||
// We temporarily re-enable display_errors to prevent any blank page related to this bug.
|
// We temporarily re-enable display_errors to prevent any blank page related to this bug.
|
||||||
|
@ -434,7 +434,7 @@ EOF;
|
|||||||
{
|
{
|
||||||
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
|
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
|
return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -442,7 +442,7 @@ EOF;
|
|||||||
*/
|
*/
|
||||||
private function escapeHtml($str)
|
private function escapeHtml($str)
|
||||||
{
|
{
|
||||||
return htmlspecialchars($str, ENT_QUOTES | (PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
|
return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ class DebugClassLoaderTest extends TestCase
|
|||||||
|
|
||||||
public function testUnsilencing()
|
public function testUnsilencing()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.');
|
$this->markTestSkipped('PHP7 throws exceptions, unsilencing is not required anymore.');
|
||||||
}
|
}
|
||||||
if (defined('HHVM_VERSION')) {
|
if (defined('HHVM_VERSION')) {
|
||||||
@ -111,7 +111,7 @@ class DebugClassLoaderTest extends TestCase
|
|||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
restore_exception_handler();
|
restore_exception_handler();
|
||||||
$this->assertStringStartsWith(__FILE__, $exception->getFile());
|
$this->assertStringStartsWith(__FILE__, $exception->getFile());
|
||||||
if (PHP_VERSION_ID < 70000) {
|
if (\PHP_VERSION_ID < 70000) {
|
||||||
$this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage());
|
$this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage());
|
||||||
$this->assertEquals(E_STRICT, $exception->getSeverity());
|
$this->assertEquals(E_STRICT, $exception->getSeverity());
|
||||||
} else {
|
} else {
|
||||||
@ -227,7 +227,7 @@ class DebugClassLoaderTest extends TestCase
|
|||||||
|
|
||||||
public function testReservedForPhp7()
|
public function testReservedForPhp7()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
$this->markTestSkipped('PHP7 already prevents using reserved names.');
|
$this->markTestSkipped('PHP7 already prevents using reserved names.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,7 @@ class Parser
|
|||||||
|
|
||||||
$node = new Node\GetAttrNode($node, $arg, $arguments, $type);
|
$node = new Node\GetAttrNode($node, $arg, $arguments, $type);
|
||||||
} elseif ('[' === $token->value) {
|
} elseif ('[' === $token->value) {
|
||||||
if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && PHP_VERSION_ID < 50400) {
|
if ($node instanceof Node\GetAttrNode && Node\GetAttrNode::METHOD_CALL === $node->attributes['type'] && \PHP_VERSION_ID < 50400) {
|
||||||
throw new SyntaxError('Array calls on a method call is only supported on PHP 5.4+', $token->cursor, $this->stream->getExpression());
|
throw new SyntaxError('Array calls on a method call is only supported on PHP 5.4+', $token->cursor, $this->stream->getExpression());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ abstract class FilterIterator extends \FilterIterator
|
|||||||
*/
|
*/
|
||||||
public function rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
|
if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
|
||||||
parent::rewind();
|
parent::rewind();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -119,7 +119,7 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @see https://bugs.php.net/68557
|
// @see https://bugs.php.net/68557
|
||||||
if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
|
if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
|
||||||
parent::next();
|
parent::next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ class DateType extends AbstractType
|
|||||||
$timezone = $formatter->getTimezoneId();
|
$timezone = $formatter->getTimezoneId();
|
||||||
$formattedTimestamps = array();
|
$formattedTimestamps = array();
|
||||||
|
|
||||||
if ($setTimeZone = PHP_VERSION_ID >= 50500 || method_exists($formatter, 'setTimeZone')) {
|
if ($setTimeZone = \PHP_VERSION_ID >= 50500 || method_exists($formatter, 'setTimeZone')) {
|
||||||
$formatter->setTimeZone('UTC');
|
$formatter->setTimeZone('UTC');
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId('UTC');
|
$formatter->setTimeZoneId('UTC');
|
||||||
|
@ -85,7 +85,7 @@ class DefaultCsrfProvider implements CsrfProviderInterface
|
|||||||
*/
|
*/
|
||||||
protected function getSessionId()
|
protected function getSessionId()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
if (PHP_SESSION_NONE === session_status()) {
|
if (PHP_SESSION_NONE === session_status()) {
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class ValidatorTypeGuesserTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testLegacyGuessRequired()
|
public function testLegacyGuessRequired()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
$this->markTestSkipped('Cannot use a class called True on PHP 7 or higher.');
|
$this->markTestSkipped('Cannot use a class called True on PHP 7 or higher.');
|
||||||
}
|
}
|
||||||
$true = 'Symfony\Component\Validator\Constraints\True';
|
$true = 'Symfony\Component\Validator\Constraints\True';
|
||||||
|
@ -121,7 +121,7 @@ class JsonResponse extends Response
|
|||||||
$data = json_encode($data, $this->encodingOptions);
|
$data = json_encode($data, $this->encodingOptions);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
// PHP 5.3 triggers annoying warnings for some
|
// PHP 5.3 triggers annoying warnings for some
|
||||||
// types that can't be serialized as JSON (INF, resources, etc.)
|
// types that can't be serialized as JSON (INF, resources, etc.)
|
||||||
// but doesn't provide the JsonSerializable interface.
|
// but doesn't provide the JsonSerializable interface.
|
||||||
@ -131,7 +131,7 @@ class JsonResponse extends Response
|
|||||||
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable
|
// PHP 5.4 and up wrap exceptions thrown by JsonSerializable
|
||||||
// objects in a new exception that needs to be removed.
|
// objects in a new exception that needs to be removed.
|
||||||
// Fortunately, PHP 5.5 and up do not trigger any warning anymore.
|
// Fortunately, PHP 5.5 and up do not trigger any warning anymore.
|
||||||
if (PHP_VERSION_ID < 50500) {
|
if (\PHP_VERSION_ID < 50500) {
|
||||||
// Clear json_last_error()
|
// Clear json_last_error()
|
||||||
json_encode(null);
|
json_encode(null);
|
||||||
$errorHandler = set_error_handler('var_dump');
|
$errorHandler = set_error_handler('var_dump');
|
||||||
@ -146,14 +146,14 @@ class JsonResponse extends Response
|
|||||||
$data = json_encode($data, $this->encodingOptions);
|
$data = json_encode($data, $this->encodingOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50500) {
|
if (\PHP_VERSION_ID < 50500) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if (PHP_VERSION_ID < 50500) {
|
if (\PHP_VERSION_ID < 50500) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
}
|
}
|
||||||
if (PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
|
if (\PHP_VERSION_ID >= 50400 && 'Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) {
|
||||||
throw $e->getPrevious() ?: $e;
|
throw $e->getPrevious() ?: $e;
|
||||||
}
|
}
|
||||||
throw $e;
|
throw $e;
|
||||||
|
@ -1502,7 +1502,7 @@ class Request
|
|||||||
public function getContent($asResource = false)
|
public function getContent($asResource = false)
|
||||||
{
|
{
|
||||||
$currentContentIsResource = is_resource($this->content);
|
$currentContentIsResource = is_resource($this->content);
|
||||||
if (PHP_VERSION_ID < 50600 && false === $this->content) {
|
if (\PHP_VERSION_ID < 50600 && false === $this->content) {
|
||||||
throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
|
throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
|
|||||||
|
|
||||||
// Adds SessionHandler functionality if available.
|
// Adds SessionHandler functionality if available.
|
||||||
// @see http://php.net/sessionhandler
|
// @see http://php.net/sessionhandler
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
class NativeSessionHandler extends \SessionHandler
|
class NativeSessionHandler extends \SessionHandler
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used)
|
session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used)
|
||||||
ini_set('session.use_cookies', 1);
|
ini_set('session.use_cookies', 1);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
session_register_shutdown();
|
session_register_shutdown();
|
||||||
} else {
|
} else {
|
||||||
register_shutdown_function('session_write_close');
|
register_shutdown_function('session_write_close');
|
||||||
@ -132,11 +132,11 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) {
|
if (\PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE === session_status()) {
|
||||||
throw new \RuntimeException('Failed to start the session: already started by PHP.');
|
throw new \RuntimeException('Failed to start the session: already started by PHP.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) {
|
if (\PHP_VERSION_ID < 50400 && !$this->closed && isset($_SESSION) && session_id()) {
|
||||||
// not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3
|
// not 100% fool-proof, but is the most reliable way to determine if a session is active in PHP 5.3
|
||||||
throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
|
throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
|
||||||
}
|
}
|
||||||
@ -197,12 +197,12 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
public function regenerate($destroy = false, $lifetime = null)
|
public function regenerate($destroy = false, $lifetime = null)
|
||||||
{
|
{
|
||||||
// Cannot regenerate the session ID for non-active sessions.
|
// Cannot regenerate the session ID for non-active sessions.
|
||||||
if (PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
|
if (\PHP_VERSION_ID >= 50400 && \PHP_SESSION_ACTIVE !== session_status()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if session ID exists in PHP 5.3
|
// Check if session ID exists in PHP 5.3
|
||||||
if (PHP_VERSION_ID < 50400 && '' === session_id()) {
|
if (\PHP_VERSION_ID < 50400 && '' === session_id()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,13 +384,13 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
|
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
|
||||||
$saveHandler = new SessionHandlerProxy($saveHandler);
|
$saveHandler = new SessionHandlerProxy($saveHandler);
|
||||||
} elseif (!$saveHandler instanceof AbstractProxy) {
|
} elseif (!$saveHandler instanceof AbstractProxy) {
|
||||||
$saveHandler = PHP_VERSION_ID >= 50400 ?
|
$saveHandler = \PHP_VERSION_ID >= 50400 ?
|
||||||
new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy();
|
new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy();
|
||||||
}
|
}
|
||||||
$this->saveHandler = $saveHandler;
|
$this->saveHandler = $saveHandler;
|
||||||
|
|
||||||
if ($this->saveHandler instanceof \SessionHandlerInterface) {
|
if ($this->saveHandler instanceof \SessionHandlerInterface) {
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
session_set_save_handler($this->saveHandler, false);
|
session_set_save_handler($this->saveHandler, false);
|
||||||
} else {
|
} else {
|
||||||
session_set_save_handler(
|
session_set_save_handler(
|
||||||
|
@ -72,7 +72,7 @@ abstract class AbstractProxy
|
|||||||
*/
|
*/
|
||||||
public function isActive()
|
public function isActive()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
return $this->active = \PHP_SESSION_ACTIVE === session_status();
|
return $this->active = \PHP_SESSION_ACTIVE === session_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ abstract class AbstractProxy
|
|||||||
*/
|
*/
|
||||||
public function setActive($flag)
|
public function setActive($flag)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
throw new \LogicException('This method is disabled in PHP 5.4.0+');
|
throw new \LogicException('This method is disabled in PHP 5.4.0+');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,7 +1029,7 @@ class RequestTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
|
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50600) {
|
if (\PHP_VERSION_ID >= 50600) {
|
||||||
$this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.');
|
$this->markTestSkipped('PHP >= 5.6 allows to open php://input several times.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class NativeFileSessionHandlerTest extends TestCase
|
|||||||
{
|
{
|
||||||
$storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir()));
|
$storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir()));
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
$this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName());
|
$this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName());
|
||||||
$this->assertEquals('files', ini_get('session.save_handler'));
|
$this->assertEquals('files', ini_get('session.save_handler'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +30,7 @@ class NativeSessionHandlerTest extends TestCase
|
|||||||
|
|
||||||
// note for PHPUnit optimisers - the use of assertTrue/False
|
// note for PHPUnit optimisers - the use of assertTrue/False
|
||||||
// here is deliberate since the tests do not require the classes to exist - drak
|
// here is deliberate since the tests do not require the classes to exist - drak
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
$this->assertFalse($handler instanceof \SessionHandler);
|
$this->assertFalse($handler instanceof \SessionHandler);
|
||||||
$this->assertTrue($handler instanceof NativeSessionHandler);
|
$this->assertTrue($handler instanceof NativeSessionHandler);
|
||||||
} else {
|
} else {
|
||||||
|
@ -196,7 +196,7 @@ class NativeSessionStorageTest extends TestCase
|
|||||||
|
|
||||||
public function testSetSaveHandler53()
|
public function testSetSaveHandler53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ class NativeSessionStorageTest extends TestCase
|
|||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
$this->assertTrue(isset($_SESSION));
|
$this->assertTrue(isset($_SESSION));
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
// this only works in PHP >= 5.4 where session_status is available
|
// this only works in PHP >= 5.4 where session_status is available
|
||||||
$this->assertTrue($storage->getSaveHandler()->isActive());
|
$this->assertTrue($storage->getSaveHandler()->isActive());
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class PhpBridgeSessionStorageTest extends TestCase
|
|||||||
|
|
||||||
public function testPhpSession53()
|
public function testPhpSession53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class AbstractProxyTest extends TestCase
|
|||||||
|
|
||||||
public function testIsActivePhp53()
|
public function testIsActivePhp53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ class AbstractProxyTest extends TestCase
|
|||||||
|
|
||||||
public function testSetActivePhp53()
|
public function testSetActivePhp53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ class AbstractProxyTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testNameExceptionPhp53()
|
public function testNameExceptionPhp53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ class AbstractProxyTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testIdExceptionPhp53()
|
public function testIdExceptionPhp53()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class SessionHandlerProxyTest extends TestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->proxy->isActive());
|
$this->assertFalse($this->proxy->isActive());
|
||||||
$this->proxy->open('name', 'id');
|
$this->proxy->open('name', 'id');
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
$this->assertTrue($this->proxy->isActive());
|
$this->assertTrue($this->proxy->isActive());
|
||||||
} else {
|
} else {
|
||||||
$this->assertFalse($this->proxy->isActive());
|
$this->assertFalse($this->proxy->isActive());
|
||||||
|
@ -71,7 +71,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$trace = DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS;
|
$trace = DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS;
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$trace = debug_backtrace($trace, 7);
|
$trace = debug_backtrace($trace, 7);
|
||||||
} else {
|
} else {
|
||||||
$trace = debug_backtrace($trace);
|
$trace = debug_backtrace($trace);
|
||||||
@ -263,7 +263,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||||||
|
|
||||||
private function doDump($data, $name, $file, $line)
|
private function doDump($data, $name, $file, $line)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400 && $this->dumper instanceof CliDumper) {
|
if (\PHP_VERSION_ID >= 50400 && $this->dumper instanceof CliDumper) {
|
||||||
$contextDumper = function ($name, $file, $line, $fileLinkFormat) {
|
$contextDumper = function ($name, $file, $line, $fileLinkFormat) {
|
||||||
if ($this instanceof HtmlDumper) {
|
if ($this instanceof HtmlDumper) {
|
||||||
if ('' !== $file) {
|
if ('' !== $file) {
|
||||||
|
@ -107,7 +107,7 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
}
|
}
|
||||||
$renderedAttributes = '';
|
$renderedAttributes = '';
|
||||||
if (count($attributes) > 0) {
|
if (count($attributes) > 0) {
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||||
} else {
|
} else {
|
||||||
$flags = ENT_QUOTES;
|
$flags = ENT_QUOTES;
|
||||||
|
@ -753,7 +753,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface
|
|||||||
|
|
||||||
$output .= $rawChunk;
|
$output .= $rawChunk;
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||||
unset($tokens, $rawChunk);
|
unset($tokens, $rawChunk);
|
||||||
gc_mem_caches();
|
gc_mem_caches();
|
||||||
|
@ -184,7 +184,7 @@ class ControllerResolverTest extends TestCase
|
|||||||
$request->attributes->set('foobar', 'foobar');
|
$request->attributes->set('foobar', 'foobar');
|
||||||
$controller = array(new self(), 'controllerMethod3');
|
$controller = array(new self(), 'controllerMethod3');
|
||||||
|
|
||||||
if (PHP_VERSION_ID === 50316) {
|
if (\PHP_VERSION_ID === 50316) {
|
||||||
$this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system');
|
$this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system');
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -68,7 +68,7 @@ class DumpDataCollectorTest extends TestCase
|
|||||||
$collector->collect(new Request(), new Response());
|
$collector->collect(new Request(), new Response());
|
||||||
$output = ob_get_clean();
|
$output = ob_get_clean();
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
|
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n123\n", $output);
|
||||||
} else {
|
} else {
|
||||||
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n123\n", $output);
|
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n123\n", $output);
|
||||||
@ -86,7 +86,7 @@ class DumpDataCollectorTest extends TestCase
|
|||||||
$collector->dump($data);
|
$collector->dump($data);
|
||||||
$line = __LINE__ - 1;
|
$line = __LINE__ - 1;
|
||||||
$file = __FILE__;
|
$file = __FILE__;
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$xOutput = <<<EOTXT
|
$xOutput = <<<EOTXT
|
||||||
<pre class=sf-dump id=sf-dump data-indent-pad=" "><a href="test://{$file}:{$line}" title="{$file}"><span class=sf-dump-meta>DumpDataCollectorTest.php</span></a> on line <span class=sf-dump-meta>{$line}</span>:
|
<pre class=sf-dump id=sf-dump data-indent-pad=" "><a href="test://{$file}:{$line}" title="{$file}"><span class=sf-dump-meta>DumpDataCollectorTest.php</span></a> on line <span class=sf-dump-meta>{$line}</span>:
|
||||||
<span class=sf-dump-num>123</span>
|
<span class=sf-dump-num>123</span>
|
||||||
@ -124,7 +124,7 @@ EOTXT;
|
|||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
$collector->__destruct();
|
$collector->__destruct();
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
|
$this->assertSame("DumpDataCollectorTest.php on line {$line}:\n456\n", ob_get_clean());
|
||||||
} else {
|
} else {
|
||||||
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
|
$this->assertSame("\"DumpDataCollectorTest.php on line {$line}:\"\n456\n", ob_get_clean());
|
||||||
|
@ -35,7 +35,7 @@ class JsonBundleWriter implements BundleWriterInterface
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
// Use JSON_PRETTY_PRINT so that we can see what changed in Git diffs
|
// Use JSON_PRETTY_PRINT so that we can see what changed in Git diffs
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
$path.'/'.$locale.'.json',
|
$path.'/'.$locale.'.json',
|
||||||
|
@ -209,7 +209,7 @@ class IntlDateFormatter
|
|||||||
$argumentError = null;
|
$argumentError = null;
|
||||||
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
|
if (!is_int($timestamp) && !$timestamp instanceof \DateTime) {
|
||||||
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
|
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
|
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ class IntlDateFormatter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
|
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
return date_default_timezone_get();
|
return date_default_timezone_get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -536,7 +536,7 @@ class IntlDateFormatter
|
|||||||
{
|
{
|
||||||
if (null === $timeZoneId) {
|
if (null === $timeZoneId) {
|
||||||
// In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method
|
// In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$timeZoneId = date_default_timezone_get();
|
$timeZoneId = date_default_timezone_get();
|
||||||
} else {
|
} else {
|
||||||
// TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will
|
// TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will
|
||||||
@ -567,7 +567,7 @@ class IntlDateFormatter
|
|||||||
$timeZone = $this->getTimeZoneId();
|
$timeZone = $this->getTimeZoneId();
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$timeZoneId = $timeZone = $this->getTimeZoneId();
|
$timeZoneId = $timeZone = $this->getTimeZoneId();
|
||||||
} else {
|
} else {
|
||||||
$timeZoneId = 'UTC';
|
$timeZoneId = 'UTC';
|
||||||
|
@ -854,7 +854,7 @@ class NumberFormatter
|
|||||||
// The negative PHP_INT_MAX was being converted to float
|
// The negative PHP_INT_MAX was being converted to float
|
||||||
if (
|
if (
|
||||||
$value == -self::$int32Max - 1 &&
|
$value == -self::$int32Max - 1 &&
|
||||||
((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone')))
|
((\PHP_VERSION_ID < 50400 && \PHP_VERSION_ID >= 50314) || \PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone')))
|
||||||
) {
|
) {
|
||||||
return (int) $value;
|
return (int) $value;
|
||||||
}
|
}
|
||||||
@ -867,7 +867,7 @@ class NumberFormatter
|
|||||||
// A 32 bit integer was being generated instead of a 64 bit integer
|
// A 32 bit integer was being generated instead of a 64 bit integer
|
||||||
if (
|
if (
|
||||||
($value > self::$int32Max || $value < -self::$int32Max - 1) &&
|
($value > self::$int32Max || $value < -self::$int32Max - 1) &&
|
||||||
(PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) &&
|
(\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) &&
|
||||||
!(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))
|
!(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))
|
||||||
) {
|
) {
|
||||||
$value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value));
|
$value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value));
|
||||||
|
@ -51,7 +51,7 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
public function testReadDoesNotFollowFallback()
|
public function testReadDoesNotFollowFallback()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
|
if (\PHP_VERSION_ID < 50307 || \PHP_VERSION_ID === 50400) {
|
||||||
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ class IntlBundleReaderTest extends TestCase
|
|||||||
|
|
||||||
public function testReadDoesNotFollowFallbackAlias()
|
public function testReadDoesNotFollowFallbackAlias()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
|
if (\PHP_VERSION_ID < 50307 || \PHP_VERSION_ID === 50400) {
|
||||||
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class JsonBundleWriterTest extends TestCase
|
|||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class PhpBundleWriterTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testWriteResourceBundle()
|
public function testWriteResourceBundle()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50315 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
|
if (\PHP_VERSION_ID < 50315 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
|
||||||
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
|
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
|
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
|
||||||
|
|
||||||
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
|
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId());
|
$this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId());
|
||||||
} else {
|
} else {
|
||||||
$this->assertNull($formatter->getTimeZoneId());
|
$this->assertNull($formatter->getTimeZoneId());
|
||||||
@ -277,7 +277,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
public function formatErrorProvider()
|
public function formatErrorProvider()
|
||||||
{
|
{
|
||||||
// With PHP 5.5 IntlDateFormatter accepts empty values ('0')
|
// With PHP 5.5 IntlDateFormatter accepts empty values ('0')
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
return array(
|
return array(
|
||||||
array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR'),
|
array('y-M-d', 'foobar', 'datefmt_format: string \'foobar\' is not numeric, which would be required for it to be a valid date: U_ILLEGAL_ARGUMENT_ERROR'),
|
||||||
);
|
);
|
||||||
@ -330,7 +330,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
// As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC
|
// As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC
|
||||||
if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
// When time zone not exists, uses UTC by default
|
// When time zone not exists, uses UTC by default
|
||||||
$data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00');
|
$data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00');
|
||||||
$data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00');
|
$data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00');
|
||||||
@ -413,7 +413,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getDefaultDateFormatter('zzzz');
|
$formatter = $this->getDefaultDateFormatter('zzzz');
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$formatter->setTimeZone('GMT+03:00');
|
$formatter->setTimeZone('GMT+03:00');
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId('GMT+03:00');
|
$formatter->setTimeZoneId('GMT+03:00');
|
||||||
@ -426,7 +426,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getDefaultDateFormatter('zzzz');
|
$formatter = $this->getDefaultDateFormatter('zzzz');
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$formatter->setTimeZone('GMT+00:30');
|
$formatter->setTimeZone('GMT+00:30');
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId('GMT+00:30');
|
$formatter->setTimeZoneId('GMT+00:30');
|
||||||
@ -439,7 +439,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getDefaultDateFormatter('zzzz');
|
$formatter = $this->getDefaultDateFormatter('zzzz');
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$formatter->setTimeZone('Pacific/Fiji');
|
$formatter->setTimeZone('Pacific/Fiji');
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId('Pacific/Fiji');
|
$formatter->setTimeZoneId('Pacific/Fiji');
|
||||||
@ -471,7 +471,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
|
|
||||||
public function testFormatWithDateTimeZoneGmtOffset()
|
public function testFormatWithDateTimeZoneGmtOffset()
|
||||||
{
|
{
|
||||||
if (defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) {
|
if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) {
|
||||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,7 +485,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
if (!extension_loaded('intl')) {
|
if (!extension_loaded('intl')) {
|
||||||
$this->markTestSkipped('Extension intl is required.');
|
$this->markTestSkipped('Extension intl is required.');
|
||||||
}
|
}
|
||||||
if (PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) {
|
if (\PHP_VERSION_ID < 50500 && !method_exists('IntlDateFormatter', 'setTimeZone')) {
|
||||||
$this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.');
|
$this->markTestSkipped('Only in PHP 5.5+ IntlDateFormatter allows to use DateTimeZone objects.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
|
|
||||||
public function testFormatWithTimezoneFromEnvironmentVariable()
|
public function testFormatWithTimezoneFromEnvironmentVariable()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.');
|
$this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,7 +519,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
|
|
||||||
public function testFormatWithTimezoneFromPhp()
|
public function testFormatWithTimezoneFromPhp()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID < 50500 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).');
|
$this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,7 +949,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getDefaultDateFormatter();
|
$formatter = $this->getDefaultDateFormatter();
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$formatter->setTimeZone($timeZoneId);
|
$formatter->setTimeZone($timeZoneId);
|
||||||
} else {
|
} else {
|
||||||
$formatter->setTimeZoneId($timeZoneId);
|
$formatter->setTimeZoneId($timeZoneId);
|
||||||
@ -960,7 +960,7 @@ abstract class AbstractIntlDateFormatterTest extends TestCase
|
|||||||
|
|
||||||
public function setTimeZoneIdProvider()
|
public function setTimeZoneIdProvider()
|
||||||
{
|
{
|
||||||
$isPhp55 = PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'));
|
$isPhp55 = \PHP_VERSION_ID >= 50500 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'));
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
array('UTC', 'UTC'),
|
array('UTC', 'UTC'),
|
||||||
|
@ -701,7 +701,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
|
|
||||||
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
||||||
// The negative PHP_INT_MAX was being converted to float
|
// The negative PHP_INT_MAX was being converted to float
|
||||||
if ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if ((\PHP_VERSION_ID < 50400 && \PHP_VERSION_ID >= 50314) || \PHP_VERSION_ID >= 50404 || (extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$this->assertInternalType('int', $parsedValue);
|
$this->assertInternalType('int', $parsedValue);
|
||||||
} else {
|
} else {
|
||||||
$this->assertInternalType('float', $parsedValue);
|
$this->assertInternalType('float', $parsedValue);
|
||||||
@ -758,7 +758,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
|
|
||||||
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
||||||
// A 32 bit integer was being generated instead of a 64 bit integer
|
// A 32 bit integer was being generated instead of a 64 bit integer
|
||||||
if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
|
if (\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
|
||||||
$this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
$this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
||||||
} else {
|
} else {
|
||||||
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
||||||
@ -769,7 +769,7 @@ abstract class AbstractNumberFormatterTest extends TestCase
|
|||||||
|
|
||||||
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
||||||
// A 32 bit integer was being generated instead of a 64 bit integer
|
// A 32 bit integer was being generated instead of a 64 bit integer
|
||||||
if (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
|
if (\PHP_VERSION_ID < 50314 || (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50404)) {
|
||||||
$this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
$this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
||||||
} else {
|
} else {
|
||||||
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
||||||
|
@ -166,7 +166,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
$overwrite = true;
|
$overwrite = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (PHP_VERSION_ID < 70000 && false === self::$previousErrorHandler) {
|
if (\PHP_VERSION_ID < 70000 && false === self::$previousErrorHandler) {
|
||||||
self::$previousErrorHandler = set_error_handler(self::$errorHandler);
|
self::$previousErrorHandler = set_error_handler(self::$errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class PropertyAccessor implements PropertyAccessorInterface
|
|||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 70000 && false !== self::$previousErrorHandler) {
|
if (\PHP_VERSION_ID < 70000 && false !== self::$previousErrorHandler) {
|
||||||
restore_error_handler();
|
restore_error_handler();
|
||||||
self::$previousErrorHandler = false;
|
self::$previousErrorHandler = false;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class AnnotationFileLoader extends FileLoader
|
|||||||
$collection->addResource(new FileResource($path));
|
$collection->addResource(new FileResource($path));
|
||||||
$collection->addCollection($this->loader->load($class, $type));
|
$collection->addCollection($this->loader->load($class, $type));
|
||||||
}
|
}
|
||||||
if (PHP_VERSION_ID >= 70000) {
|
if (\PHP_VERSION_ID >= 70000) {
|
||||||
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
// PHP 7 memory manager will not release after token_get_all(), see https://bugs.php.net/70098
|
||||||
gc_mem_caches();
|
gc_mem_caches();
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ class NativeSessionTokenStorage implements TokenStorageInterface
|
|||||||
|
|
||||||
private function startSession()
|
private function startSession()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
if (PHP_SESSION_NONE === session_status()) {
|
if (PHP_SESSION_NONE === session_status()) {
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class SessionAuthenticationStrategy implements SessionAuthenticationStrategyInte
|
|||||||
case self::MIGRATE:
|
case self::MIGRATE:
|
||||||
// Destroying the old session is broken in php 5.4.0 - 5.4.10
|
// Destroying the old session is broken in php 5.4.0 - 5.4.10
|
||||||
// See php bug #63379
|
// See php bug #63379
|
||||||
$destroy = PHP_VERSION_ID < 50400 || PHP_VERSION_ID >= 50411;
|
$destroy = \PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411;
|
||||||
$request->getSession()->migrate($destroy);
|
$request->getSession()->migrate($destroy);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -40,7 +40,7 @@ class SessionAuthenticationStrategyTest extends TestCase
|
|||||||
|
|
||||||
public function testSessionIsMigrated()
|
public function testSessionIsMigrated()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50411) {
|
if (\PHP_VERSION_ID >= 50400 && \PHP_VERSION_ID < 50411) {
|
||||||
$this->markTestSkipped('We cannot destroy the old session on PHP 5.4.0 - 5.4.10.');
|
$this->markTestSkipped('We cannot destroy the old session on PHP 5.4.0 - 5.4.10.');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ class SessionAuthenticationStrategyTest extends TestCase
|
|||||||
|
|
||||||
public function testSessionIsMigratedWithPhp54Workaround()
|
public function testSessionIsMigratedWithPhp54Workaround()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50400 || PHP_VERSION_ID >= 50411) {
|
if (\PHP_VERSION_ID < 50400 || \PHP_VERSION_ID >= 50411) {
|
||||||
$this->markTestSkipped('This PHP version is not affected.');
|
$this->markTestSkipped('This PHP version is not affected.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class JsonDecode implements DecoderInterface
|
|||||||
$recursionDepth = $context['json_decode_recursion_depth'];
|
$recursionDepth = $context['json_decode_recursion_depth'];
|
||||||
$options = $context['json_decode_options'];
|
$options = $context['json_decode_options'];
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
|
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
|
||||||
} else {
|
} else {
|
||||||
$decodedData = json_decode($data, $associative, $recursionDepth);
|
$decodedData = json_decode($data, $associative, $recursionDepth);
|
||||||
|
@ -417,7 +417,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
|
|||||||
protected function initializeEscapers()
|
protected function initializeEscapers()
|
||||||
{
|
{
|
||||||
$that = $this;
|
$that = $this;
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
$flags = ENT_QUOTES | ENT_SUBSTITUTE;
|
||||||
} else {
|
} else {
|
||||||
$flags = ENT_QUOTES;
|
$flags = ENT_QUOTES;
|
||||||
|
@ -19,7 +19,7 @@ class JsonFileDumperTest extends TestCase
|
|||||||
{
|
{
|
||||||
public function testDump()
|
public function testDump()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50400) {
|
if (\PHP_VERSION_ID < 50400) {
|
||||||
$this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing');
|
$this->markTestIncomplete('PHP below 5.4 doesn\'t support JSON pretty printing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintVal
|
|||||||
{
|
{
|
||||||
protected static function addPhp5Dot5Comparisons(array $comparisons)
|
protected static function addPhp5Dot5Comparisons(array $comparisons)
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID < 50500) {
|
if (\PHP_VERSION_ID < 50500) {
|
||||||
return $comparisons;
|
return $comparisons;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ abstract class AbstractComparisonValidatorTestCase extends AbstractConstraintVal
|
|||||||
if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) {
|
if ($dirtyValue instanceof \DateTime || $dirtyValue instanceof \DateTimeInterface) {
|
||||||
IntlTestHelper::requireIntl($this, '57.1');
|
IntlTestHelper::requireIntl($this, '57.1');
|
||||||
|
|
||||||
if (PHP_VERSION_ID < 50304 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
if (\PHP_VERSION_ID < 50304 && !(extension_loaded('intl') && method_exists('IntlDateFormatter', 'setTimeZone'))) {
|
||||||
$this->markTestSkipped('Intl supports formatting DateTime objects since 5.3.4');
|
$this->markTestSkipped('Intl supports formatting DateTime objects since 5.3.4');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ class IdenticalToValidatorTest extends AbstractComparisonValidatorTestCase
|
|||||||
array(null, 1),
|
array(null, 1),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500) {
|
if (\PHP_VERSION_ID >= 50500) {
|
||||||
$immutableDate = new \DateTimeImmutable('2000-01-01');
|
$immutableDate = new \DateTimeImmutable('2000-01-01');
|
||||||
$comparisons[] = array($immutableDate, $immutableDate);
|
$comparisons[] = array($immutableDate, $immutableDate);
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
array(new \DateTime('March 20, 2014')),
|
array(new \DateTime('March 20, 2014')),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500) {
|
if (\PHP_VERSION_ID >= 50500) {
|
||||||
$tests[] = array(new \DateTimeImmutable('March 10, 2014'));
|
$tests[] = array(new \DateTimeImmutable('March 10, 2014'));
|
||||||
$tests[] = array(new \DateTimeImmutable('March 15, 2014'));
|
$tests[] = array(new \DateTimeImmutable('March 15, 2014'));
|
||||||
$tests[] = array(new \DateTimeImmutable('March 20, 2014'));
|
$tests[] = array(new \DateTimeImmutable('March 20, 2014'));
|
||||||
@ -216,7 +216,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'),
|
array(new \DateTime('March 9, 2014'), 'Mar 9, 2014, 12:00 AM'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500) {
|
if (\PHP_VERSION_ID >= 50500) {
|
||||||
$tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM');
|
$tests[] = array(new \DateTimeImmutable('March 20, 2013'), 'Mar 20, 2013, 12:00 AM');
|
||||||
$tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM');
|
$tests[] = array(new \DateTimeImmutable('March 9, 2014'), 'Mar 9, 2014, 12:00 AM');
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ class RangeValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'),
|
array(new \DateTime('March 9, 2015'), 'Mar 9, 2015, 12:00 AM'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50500) {
|
if (\PHP_VERSION_ID >= 50500) {
|
||||||
$tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM');
|
$tests[] = array(new \DateTimeImmutable('March 21, 2014'), 'Mar 21, 2014, 12:00 AM');
|
||||||
$tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM');
|
$tests[] = array(new \DateTimeImmutable('March 9, 2015'), 'Mar 9, 2015, 12:00 AM');
|
||||||
}
|
}
|
||||||
|
@ -308,7 +308,7 @@ class VarCloner extends AbstractCloner
|
|||||||
} else {
|
} else {
|
||||||
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
|
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
|
||||||
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
|
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
|
||||||
foreach (debug_backtrace(PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) {
|
foreach (debug_backtrace(\PHP_VERSION_ID >= 50400 ? DEBUG_BACKTRACE_IGNORE_ARGS : false) as $frame) {
|
||||||
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
|
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
|
||||||
$frame['line'] = 0;
|
$frame['line'] = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -45,7 +45,7 @@ class CliDumperTest extends VarDumperTestCase
|
|||||||
$closure54 = '';
|
$closure54 = '';
|
||||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$closure54 = <<<EOTXT
|
$closure54 = <<<EOTXT
|
||||||
|
|
||||||
class: "Symfony\Component\VarDumper\Tests\CliDumperTest"
|
class: "Symfony\Component\VarDumper\Tests\CliDumperTest"
|
||||||
@ -364,7 +364,7 @@ EOTXT
|
|||||||
*/
|
*/
|
||||||
public function testBuggyRefs()
|
public function testBuggyRefs()
|
||||||
{
|
{
|
||||||
if (PHP_VERSION_ID >= 50600) {
|
if (\PHP_VERSION_ID >= 50600) {
|
||||||
$this->markTestSkipped('PHP 5.6 fixed refs counting');
|
$this->markTestSkipped('PHP 5.6 fixed refs counting');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class HtmlDumperTest extends TestCase
|
|||||||
$closure54 = '';
|
$closure54 = '';
|
||||||
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
|
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
|
||||||
|
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$closure54 = <<<EOTXT
|
$closure54 = <<<EOTXT
|
||||||
|
|
||||||
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="48 characters">Symfony\Component\VarDumper\Tests\HtmlDumperTest</span>"
|
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="48 characters">Symfony\Component\VarDumper\Tests\HtmlDumperTest</span>"
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Skipping trait tests for PHP < 5.4
|
// Skipping trait tests for PHP < 5.4
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
require __DIR__.'/VarDumperTestTraitRequire54.php';
|
require __DIR__.'/VarDumperTestTraitRequire54.php';
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class ParseException extends RuntimeException
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $this->parsedFile) {
|
if (null !== $this->parsedFile) {
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
$jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
|
||||||
} else {
|
} else {
|
||||||
$jsonOptions = 0;
|
$jsonOptions = 0;
|
||||||
|
@ -19,7 +19,7 @@ class ParseExceptionTest extends TestCase
|
|||||||
public function testGetMessage()
|
public function testGetMessage()
|
||||||
{
|
{
|
||||||
$exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
|
$exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
|
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
|
||||||
} else {
|
} else {
|
||||||
$message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")';
|
$message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")';
|
||||||
@ -31,7 +31,7 @@ class ParseExceptionTest extends TestCase
|
|||||||
public function testGetMessageWithUnicodeInFilename()
|
public function testGetMessageWithUnicodeInFilename()
|
||||||
{
|
{
|
||||||
$exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
|
$exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
|
||||||
if (PHP_VERSION_ID >= 50400) {
|
if (\PHP_VERSION_ID >= 50400) {
|
||||||
$message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
|
$message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
|
||||||
} else {
|
} else {
|
||||||
$message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
|
$message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
|
||||||
|
Reference in New Issue
Block a user