diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index 3f28cb5ad2567..14520c1c6fa7a 100644
--- a/UPGRADE-3.0.md
+++ b/UPGRADE-3.0.md
@@ -6,13 +6,15 @@ UPGRADE FROM 2.x to 3.0
* The `UniversalClassLoader` class has been removed in favor of
`ClassLoader`. The only difference is that some method names are different:
- * `registerNamespaces()` -> `addPrefixes()`
- * `registerPrefixes()` -> `addPrefixes()`
- * `registerNamespace()` -> `addPrefix()`
- * `registerPrefix()` -> `addPrefix()`
- * `getNamespaces()` -> `getPrefixes()`
- * `getNamespaceFallbacks()` -> `getFallbackDirs()`
- * `getPrefixFallbacks()` -> `getFallbackDirs()`
+ | Old name | New name
+ | -------- | ---
+ | `registerNamespaces()` | `addPrefixes()`
+ | `registerPrefixes()` | `addPrefixes()`
+ | `registerNamespaces()` | `addPrefix()`
+ | `registerPrefixes()` | `addPrefix()`
+ | `getNamespaces()` | `getPrefixes()`
+ | `getNamespaceFallbacks()` | `getFallbackDirs()`
+ | `getPrefixFallbacks()` | `getFallbackDirs()`
* The `DebugUniversalClassLoader` class has been removed in favor of
`DebugClassLoader`. The difference is that the constructor now takes a
@@ -29,7 +31,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$h = new ProgressHelper();
$h->start($output, 10);
for ($i = 1; $i < 5; $i++) {
@@ -41,7 +43,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
$bar = new ProgressBar($output, 10);
$bar->start();
for ($i = 1; $i < 5; $i++) {
@@ -54,7 +56,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$table = $app->getHelperSet()->get('table');
$table
->setHeaders(array('ISBN', 'Title', 'Author'))
@@ -70,7 +72,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Console\Helper\Table;
$table = new Table($output);
@@ -157,8 +159,8 @@ UPGRADE FROM 2.x to 3.0
}
```
- * The events PRE_BIND, BIND and POST_BIND were renamed to PRE_SUBMIT, SUBMIT
- and POST_SUBMIT.
+ * The events `PRE_BIND`, `BIND` and `POST_BIND` were renamed to `PRE_SUBMIT`, `SUBMIT`
+ and `POST_SUBMIT`.
Before:
@@ -176,7 +178,7 @@ UPGRADE FROM 2.x to 3.0
});
```
- * The option "virtual" was renamed to "inherit_data".
+ * The option "`virtual`" was renamed to "`inherit_data`".
Before:
@@ -194,7 +196,7 @@ UPGRADE FROM 2.x to 3.0
));
```
- * The class VirtualFormAwareIterator was renamed to InheritDataAwareIterator.
+ * The class `VirtualFormAwareIterator` was renamed to `InheritDataAwareIterator`.
Before:
@@ -252,8 +254,8 @@ UPGRADE FROM 2.x to 3.0
and all of its implementations were removed. Use the new interface
`Symfony\Component\Security\Csrf\CsrfTokenManagerInterface` instead.
- * The options "csrf_provider" and "intention" were renamed to "csrf_token_generator"
- and "csrf_token_id".
+ * The options "`csrf_provider`" and "`intention`" were renamed to "`csrf_token_generator`"
+ and "`csrf_token_id`".
* The method `Form::getErrorsAsString()` was removed. Use `Form::getErrors()`
instead with the argument `$deep` set to true and `$flatten` set to false
@@ -261,16 +263,19 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
echo $form->getErrorsAsString();
```
After:
- ```
+ ```php
echo $form->getErrors(true, false);
```
+ ```php
+ echo $form->getErrors(true, false);
+ ```
### FrameworkBundle
@@ -280,7 +285,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
namespace Acme\FooBundle\Controller;
class DemoController
@@ -295,7 +300,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
namespace Acme\FooBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
@@ -370,10 +375,12 @@ UPGRADE FROM 2.x to 3.0
favor of `Psr\Log\LoggerInterface`. The only difference is that some method
names are different:
- * `emerg()` -> `emergency()`
- * `crit()` -> `critical()`
- * `err()` -> `error()`
- * `warn()` -> `warning()`
+ | Old name | New name
+ | -------- | ---
+ | `emerg()` | `emergency()`
+ | `crit()` | `critical()`
+ | `err()` | `error()`
+ | `warn()` | `warning()`
The previous method renames also happened to the following classes:
@@ -385,10 +392,12 @@ UPGRADE FROM 2.x to 3.0
* The following classes have been renamed as they have been moved to the
Debug component:
- * `Symfony\Component\HttpKernel\Debug\ErrorHandler` -> `Symfony\Component\Debug\ErrorHandler`
- * `Symfony\Component\HttpKernel\Debug\ExceptionHandler` -> `Symfony\Component\Debug\ExceptionHandler`
- * `Symfony\Component\HttpKernel\Exception\FatalErrorException` -> `Symfony\Component\Debug\Exception\FatalErrorException`
- * `Symfony\Component\HttpKernel\Exception\FlattenException` -> `Symfony\Component\Debug\Exception\FlattenException`
+ | Old name | New name
+ | -------- | ---
+ | `Symfony\Component\HttpKernel\Debug\ErrorHandler` | `Symfony\Component\Debug\ErrorHandler`
+ | `Symfony\Component\HttpKernel\Debug\ExceptionHandler` | `Symfony\Component\Debug\ExceptionHandler`
+ | `Symfony\Component\HttpKernel\Exception\FatalErrorException` | `Symfony\Component\Debug\Exception\FatalErrorException`
+ | `Symfony\Component\HttpKernel\Exception\FlattenException` | `Symfony\Component\Debug\Exception\FlattenException`
* The `Symfony\Component\HttpKernel\EventListener\ExceptionListener` now
passes the Request format as the `_format` argument instead of `format`.
@@ -402,12 +411,14 @@ UPGRADE FROM 2.x to 3.0
Instead of the methods in `Symfony\Component\Locale\Locale`, you should use
these equivalent methods in `Symfony\Component\Intl\Intl` now:
- * `Locale::getDisplayCountries()` -> `Intl::getRegionBundle()->getCountryNames()`
- * `Locale::getCountries()` -> `array_keys(Intl::getRegionBundle()->getCountryNames())`
- * `Locale::getDisplayLanguages()` -> `Intl::getLanguageBundle()->getLanguageNames()`
- * `Locale::getLanguages()` -> `array_keys(Intl::getLanguageBundle()->getLanguageNames())`
- * `Locale::getDisplayLocales()` -> `Intl::getLocaleBundle()->getLocaleNames()`
- * `Locale::getLocales()` -> `array_keys(Intl::getLocaleBundle()->getLocaleNames())`
+ | Old way | New way
+ | ------- | ---
+ | `Locale::getDisplayCountries()` | `Intl::getRegionBundle()->getCountryNames()`
+ | `Locale::getCountries()` | `array_keys(Intl::getRegionBundle()->getCountryNames())`
+ | `Locale::getDisplayLanguages()` | `Intl::getLanguageBundle()->getLanguageNames()`
+ | `Locale::getLanguages()` | `array_keys(Intl::getLanguageBundle()->getLanguageNames())`
+ | `Locale::getDisplayLocales()` | `Intl::getLocaleBundle()->getLocaleNames()`
+ | `Locale::getLocales()` | `array_keys(Intl::getLocaleBundle()->getLocaleNames())`
### PropertyAccess
@@ -556,7 +567,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Cache\ApcCache;
$cache = new ApcCache('symfony.validator');
@@ -564,7 +575,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Cache\DoctrineCache;
use Doctrine\Common\Cache\ApcCache;
@@ -606,31 +617,31 @@ UPGRADE FROM 2.x to 3.0
private $property;
```
- * The option "methods" of the `Callback` constraint was removed. You should
- use the option "callback" instead. If you have multiple callbacks, add
+ * The option "`methods`" of the `Callback` constraint was removed. You should
+ use the option "`callback`" instead. If you have multiple callbacks, add
multiple callback constraints instead.
Before (YAML):
- ```
+ ```yaml
constraints:
- Callback: [firstCallback, secondCallback]
```
After (YAML):
- ```
+ ```yaml
constraints:
- Callback: firstCallback
- Callback: secondCallback
```
- When using annotations, you can now put the Callback constraint directly on
+ When using annotations, you can now put the `Callback` constraint directly on
the method that should be executed.
Before (Annotations):
- ```
+ ```php
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;
@@ -648,7 +659,7 @@ UPGRADE FROM 2.x to 3.0
After (Annotations):
- ```
+ ```php
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\ExecutionContextInterface;
@@ -672,7 +683,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$validator->validate($object, 'Strict');
$validator->validateValue($value, new NotNull());
@@ -680,7 +691,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
$validator->validate($object, null, 'Strict');
$validator->validate($value, new NotNull());
@@ -690,7 +701,7 @@ UPGRADE FROM 2.x to 3.0
were added. The first of them allows to run multiple validations in the
same context and aggregate their violations:
- ```
+ ```php
$violations = $validator->startContext()
->atPath('firstName')->validate($firstName, new NotNull())
->atPath('age')->validate($age, new Type('integer'))
@@ -701,7 +712,7 @@ UPGRADE FROM 2.x to 3.0
especially useful when calling the validator from within constraint
validators:
- ```
+ ```php
$validator->inContext($context)->validate($object);
```
@@ -720,13 +731,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\MetadataInterface;
```
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\MetadataInterface;
```
@@ -737,7 +748,7 @@ UPGRADE FROM 2.x to 3.0
Example:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\TraversalStrategy;
public function getTraversalStrategy()
@@ -751,13 +762,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\PropertyMetadataInterface;
```
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\PropertyMetadataInterface;
```
@@ -766,13 +777,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\PropertyMetadataContainerInterface;
```
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
```
@@ -790,7 +801,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\ClassBasedInterface;
class MyClassMetadata implements ClassBasedInterface
@@ -801,7 +812,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
class MyClassMetadata implements ClassMetadataInterface
@@ -814,7 +825,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ElementMetadata;
class MyMetadata extends ElementMetadata
@@ -824,7 +835,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\GenericMetadata;
class MyMetadata extends GenericMetadata
@@ -837,13 +848,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\ExecutionContextInterface;
```
After:
- ```
+ ```php
use Symfony\Component\Validator\Context\ExecutionContextInterface;
```
@@ -865,7 +876,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$context->addViolationAt('property', 'The value {{ value }} is invalid.', array(
'{{ value }}' => $invalidValue,
));
@@ -873,7 +884,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
$context->buildViolation('The value {{ value }} is invalid.')
->atPath('property')
->setParameter('{{ value }}', $invalidValue)
@@ -885,13 +896,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$context->validate($object);
```
After:
- ```
+ ```php
$context->getValidator()
->inContext($context)
->validate($object);
@@ -907,13 +918,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$metadata = $context->getMetadataFactory()->getMetadataFor($myClass);
```
After:
- ```
+ ```php
$metadata = $context->getValidator()->getMetadataFor($myClass);
```
@@ -928,7 +939,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
$factory = new ClassMetadataFactory($loader);
@@ -936,7 +947,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
$factory = new LazyLoadingMetadataFactory($loader);
@@ -954,14 +965,14 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$parameters = $violation->getMessageParameters();
$plural = $violation->getMessagePluralization();
```
After:
- ```
+ ```php
$parameters = $violation->getParameters();
$plural = $violation->getPlural();
```
@@ -984,6 +995,6 @@ UPGRADE FROM 2.x to 3.0
### Process
- * Process::setStdin() and Process::getStdin() have been removed. Use
- Process::setInput() and Process::getInput() that works the same way.
- * Process::setInput() and ProcessBuilder::setInput() do not accept non-scalar types.
+ * `Process::setStdin()` and `Process::getStdin()` have been removed. Use
+ `Process::setInput()` and `Process::getInput()` that works the same way.
+ * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types.
diff --git a/autoload.php.dist b/autoload.php.dist
index 0bb2bc3a85271..689f140d093f4 100644
--- a/autoload.php.dist
+++ b/autoload.php.dist
@@ -1,6 +1,6 @@
=') && gc_enabled()) {
+if (PHP_VERSION_ID >= 50400 && gc_enabled()) {
// Disabling Zend Garbage Collection to prevent segfaults with PHP5.4+
// https://bugs.php.net/bug.php?id=53976
gc_disable();
diff --git a/composer.json b/composer.json
index 5cbae051924f0..4491ed3fe60e8 100644
--- a/composer.json
+++ b/composer.json
@@ -73,7 +73,7 @@
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"monolog/monolog": "~1.11",
- "propel/propel1": "1.6.*",
+ "propel/propel1": "~1.6",
"ircmaxell/password-compat": "1.0.*",
"ocramius/proxy-manager": ">=0.3.1,<0.6-dev",
"egulias/email-validator": "~1.2"
diff --git a/src/Symfony/Bridge/Propel1/composer.json b/src/Symfony/Bridge/Propel1/composer.json
index e1fe6f469a832..d93b29d8aa3ac 100644
--- a/src/Symfony/Bridge/Propel1/composer.json
+++ b/src/Symfony/Bridge/Propel1/composer.json
@@ -20,7 +20,7 @@
"symfony/http-foundation": "~2.0",
"symfony/http-kernel": "~2.0",
"symfony/form": "~2.2",
- "propel/propel1": "1.6.*"
+ "propel/propel1": "~1.6"
},
"require-dev": {
"symfony/stopwatch": "~2.2"
diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
index 91509ea1ee5a3..93251a739e8c9 100644
--- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php
@@ -11,10 +11,6 @@
namespace Symfony\Bridge\Twig\Extension;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
/**
* Twig extension relate to PHP code and used by the profiler and the default exception templates.
*
@@ -178,7 +174,13 @@ public function formatFile($file, $line, $text = null)
$text = "$text at line $line";
if (false !== $link = $this->getFileLink($file, $line)) {
- return sprintf('%s', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text);
+ if (PHP_VERSION_ID >= 50400) {
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
+ } else {
+ $flags = ENT_QUOTES;
+ }
+
+ return sprintf('%s', htmlspecialchars($link, $flags, $this->charset), $text);
}
return $text;
diff --git a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
index ed568055db88b..5f8ae112118fb 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
@@ -66,7 +66,7 @@ public function testCompile()
protected function getVariableGetter($name)
{
- if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
index f58da757848d1..60ef9edfb9751 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
@@ -263,7 +263,7 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
protected function getVariableGetter($name)
{
- if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
index e02637f237e38..df5eb559d8c21 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
@@ -38,7 +38,7 @@ public function testCompileStrict()
}
protected function getVariableGetterWithoutStrictCheck($name)
{
- if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name);
}
@@ -47,7 +47,7 @@ protected function getVariableGetterWithoutStrictCheck($name)
protected function getVariableGetterWithStrictCheck($name)
{
- if (version_compare(phpversion(), '5.4.0RC1', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
return sprintf('(isset($context["%s"]) ? $context["%s"] : $this->getContext($context, "%s"))', $name, $name, $name);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
index 910527c81e385..8477720efc613 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
@@ -15,6 +15,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\ProcessBuilder;
/**
@@ -29,7 +30,7 @@ class ServerRunCommand extends ContainerAwareCommand
*/
public function isEnabled()
{
- if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) {
+ if (PHP_VERSION_ID < 50400 || defined('HHVM_VERSION')) {
return false;
}
@@ -44,7 +45,7 @@ protected function configure()
$this
->setDefinition(array(
new InputArgument('address', InputArgument::OPTIONAL, 'Address:port', '127.0.0.1:8000'),
- new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', 'web/'),
+ new InputOption('docroot', 'd', InputOption::VALUE_REQUIRED, 'Document root', null),
new InputOption('router', 'r', InputOption::VALUE_REQUIRED, 'Path to custom router script'),
))
->setName('server:run')
@@ -82,8 +83,18 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
+ if (defined('HHVM_VERSION')) {
+ $output->writeln('This command is not supported on HHVM.');
+
+ return 1;
+ }
+
$documentRoot = $input->getOption('docroot');
+ if (null === $documentRoot) {
+ $documentRoot = $this->getContainer()->getParameter('kernel.root_dir').'/../web';
+ }
+
if (!is_dir($documentRoot)) {
$output->writeln(sprintf('The given document root directory "%s" does not exist', $documentRoot));
@@ -99,7 +110,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(sprintf("Server running on http://%s\n", $input->getArgument('address')));
$output->writeln('Quit the server with CONTROL-C.');
- $builder = $this->createPhpProcessBuilder($input, $output, $env);
+ if (null === $builder = $this->createPhpProcessBuilder($input, $output, $env)) {
+ return 1;
+ }
+
$builder->setWorkingDirectory($documentRoot);
$builder->setTimeout(null);
$process = $builder->getProcess();
@@ -134,11 +148,18 @@ private function createPhpProcessBuilder(InputInterface $input, OutputInterface
if (!file_exists($router)) {
$output->writeln(sprintf('The given router script "%s" does not exist', $router));
- return 1;
+ return;
}
$router = realpath($router);
+ $finder = new PhpExecutableFinder();
+
+ if (false === $binary = $finder->find()) {
+ $output->writeln('Unable to find PHP binary to run server');
+
+ return;
+ }
- return new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
+ return new ProcessBuilder(array($binary, '-S', $input->getArgument('address'), $router));
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
index 4915f813b4a5b..ab2124676bf14 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
@@ -13,10 +13,6 @@
use Symfony\Component\Templating\Helper\Helper;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
/**
* CodeHelper.
*
@@ -170,7 +166,13 @@ public function formatFile($file, $line, $text = null)
}
if (false !== $link = $this->getFileLink($file, $line)) {
- return sprintf('%s', htmlspecialchars($link, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), $text);
+ if (PHP_VERSION_ID >= 50400) {
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
+ } else {
+ $flags = ENT_QUOTES;
+ }
+
+ return sprintf('%s', htmlspecialchars($link, $flags, $this->charset), $text);
}
return $text;
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index 1f20fc7596414..068c4fcc39a49 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -351,8 +351,11 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
;
}
+ // Determine default entry point
+ $defaultEntryPoint = isset($firewall['entry_point']) ? $firewall['entry_point'] : null;
+
// Authentication listeners
- list($authListeners, $defaultEntryPoint) = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider);
+ list($authListeners, $defaultEntryPoint) = $this->createAuthenticationListeners($container, $id, $firewall, $authenticationProviders, $defaultProvider, $defaultEntryPoint);
$listeners = array_merge($listeners, $authListeners);
@@ -364,11 +367,6 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
// Access listener
$listeners[] = new Reference('security.access_listener');
- // Determine default entry point
- if (isset($firewall['entry_point'])) {
- $defaultEntryPoint = $firewall['entry_point'];
- }
-
// Exception listener
$exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $defaultEntryPoint));
@@ -388,11 +386,10 @@ private function createContextListener($container, $contextKey)
return $this->contextListeners[$contextKey] = $listenerId;
}
- private function createAuthenticationListeners($container, $id, $firewall, &$authenticationProviders, $defaultProvider)
+ private function createAuthenticationListeners($container, $id, $firewall, &$authenticationProviders, $defaultProvider, $defaultEntryPoint)
{
$listeners = array();
$hasListeners = false;
- $defaultEntryPoint = null;
foreach ($this->listenerPositions as $position) {
foreach ($this->factories[$position] as $factory) {
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php
new file mode 100644
index 0000000000000..e4d5bc30f39f9
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\DependencyInjection;
+
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+
+class FirewallEntryPointExtension extends Extension
+{
+ public function load(array $config, ContainerBuilder $container)
+ {
+ $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+ $loader->load('services.xml');
+ }
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/FirewallEntryPointBundle.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/FirewallEntryPointBundle.php
new file mode 100644
index 0000000000000..f4247ad050db6
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/FirewallEntryPointBundle.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class FirewallEntryPointBundle extends Bundle
+{
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Resources/config/services.xml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Resources/config/services.xml
new file mode 100644
index 0000000000000..76abc3d262e93
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Resources/config/services.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php
new file mode 100644
index 0000000000000..e1d3280570d88
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Security/EntryPointStub.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Security\Core\Exception\AuthenticationException;
+use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
+
+class EntryPointStub implements AuthenticationEntryPointInterface
+{
+ const RESPONSE_TEXT = '2be8e651259189d841a19eecdf37e771e2431741';
+
+ public function start(Request $request, AuthenticationException $authException = null)
+ {
+ return new Response(self::RESPONSE_TEXT);
+ }
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php
new file mode 100644
index 0000000000000..23acde45a5ff9
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/FirewallEntryPointTest.php
@@ -0,0 +1,51 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
+
+use Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub;
+
+/**
+ * @group functional
+ */
+class FirewallEntryPointTest extends WebTestCase
+{
+ public function testItUsesTheConfiguredEntryPointWhenUsingUnknownCredentials()
+ {
+ $client = $this->createClient(array('test_case' => 'FirewallEntryPoint'));
+ $client->insulate();
+
+ $client->request('GET', '/secure/resource', array(), array(), array(
+ 'PHP_AUTH_USER' => 'unknown',
+ 'PHP_AUTH_PW' => 'credentials',
+ ));
+
+ $this->assertEquals(
+ EntryPointStub::RESPONSE_TEXT,
+ $client->getResponse()->getContent(),
+ "Custom entry point wasn't started"
+ );
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->deleteTmpDir('FirewallEntryPoint');
+ }
+
+ protected function tearDown()
+ {
+ parent::tearDown();
+
+ $this->deleteTmpDir('FirewallEntryPoint');
+ }
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
index 41ecde703bc63..f86ec326afa55 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
@@ -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 (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
}
@@ -46,7 +46,7 @@ public function testRoutingErrorIsExposedWhenNotProtected($config)
*/
public function testRoutingErrorIsNotExposedForProtectedResourceWhenLoggedInWithInsufficientRights($config)
{
- if (strpos(PHP_OS, "WIN") === 0 && version_compare(phpversion(), "5.3.9", "<")) {
+ if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50309) {
$this->markTestSkipped('Test hangs on Windows & PHP due to https://bugs.php.net/bug.php?id=60120 fixed in http://svn.php.net/viewvc?view=revision&revision=318366');
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php
new file mode 100644
index 0000000000000..c6fd207dd1118
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/FirewallEntryPoint/bundles.php
@@ -0,0 +1,7 @@
+= 50400) {
+ define('SYMFONY_TRAIT', T_TRAIT);
+} else {
+ define('SYMFONY_TRAIT', 0);
}
/**
@@ -113,7 +115,7 @@ private static function findClasses($path)
break;
case T_CLASS:
case T_INTERFACE:
- case T_TRAIT:
+ case SYMFONY_TRAIT:
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {
diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
index 7b71854da381d..587f36902fb9c 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php
@@ -22,7 +22,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
{
public function testTraitDependencies()
{
- if (version_compare(phpversion(), '5.4', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Requires PHP > 5.4');
return;
@@ -100,7 +100,7 @@ public function getDifferentOrders()
*/
public function testClassWithTraitsReordering(array $classes)
{
- if (version_compare(phpversion(), '5.4', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Requires PHP > 5.4');
return;
diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
index be2385ed97267..9853bcb08ec87 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
@@ -104,7 +104,7 @@ public function getTestCreateMapTests()
)),
);
- if (version_compare(PHP_VERSION, '5.4', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$data[] = array(__DIR__.'/Fixtures/php5.4', array(
'TFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
'CFoo' => __DIR__.'/Fixtures/php5.4/traits.php',
diff --git a/src/Symfony/Component/Config/ConfigCache.php b/src/Symfony/Component/Config/ConfigCache.php
index 4b58e7352a2c1..946e1be424ec1 100644
--- a/src/Symfony/Component/Config/ConfigCache.php
+++ b/src/Symfony/Component/Config/ConfigCache.php
@@ -90,7 +90,7 @@ public function isFresh()
* @param string $content The content to write in the cache
* @param ResourceInterface[] $metadata An array of ResourceInterface instances
*
- * @throws \RuntimeException When cache file can't be wrote
+ * @throws \RuntimeException When cache file can't be written
*/
public function write($content, array $metadata = null)
{
diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
index 72c485bbe9615..fcefcd83f68a9 100644
--- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
@@ -229,7 +229,7 @@ private function writeText($content, array $options = array())
*/
private function formatDefaultValue($default)
{
- if (version_compare(PHP_VERSION, '5.4', '<')) {
+ if (PHP_VERSION_ID < 50400) {
return str_replace('\/', '/', json_encode($default));
}
diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php
index 83cb9728137ac..c9c60e578a091 100644
--- a/src/Symfony/Component/Console/Input/InputDefinition.php
+++ b/src/Symfony/Component/Console/Input/InputDefinition.php
@@ -11,11 +11,6 @@
namespace Symfony\Component\Console\Input;
-if (!defined('JSON_UNESCAPED_UNICODE')) {
- define('JSON_UNESCAPED_SLASHES', 64);
- define('JSON_UNESCAPED_UNICODE', 256);
-}
-
use Symfony\Component\Console\Descriptor\TextDescriptor;
use Symfony\Component\Console\Descriptor\XmlDescriptor;
use Symfony\Component\Console\Output\BufferedOutput;
diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php
index 2c11619f14128..a0d03236de398 100644
--- a/src/Symfony/Component/Debug/ExceptionHandler.php
+++ b/src/Symfony/Component/Debug/ExceptionHandler.php
@@ -15,10 +15,6 @@
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\Debug\Exception\OutOfMemoryException;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
/**
* ExceptionHandler converts an exception to a Response object.
*
@@ -388,6 +384,11 @@ private function formatPath($path, $line)
*/
private function formatArgs(array $args)
{
+ if (PHP_VERSION_ID >= 50400) {
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
+ } else {
+ $flags = ENT_QUOTES;
+ }
$result = array();
foreach ($args as $key => $item) {
if ('object' === $item[0]) {
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 11519972d8e2e..5b9d745cd67ff 100755
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -575,7 +575,7 @@ public function html()
$html = '';
foreach ($this->getNode(0)->childNodes as $child) {
- if (version_compare(PHP_VERSION, '5.3.6', '>=')) {
+ if (PHP_VERSION_ID >= 50306) {
// node parameter was added to the saveHTML() method in PHP 5.3.6
// @see http://php.net/manual/en/domdocument.savehtml.php
$html .= $child->ownerDocument->saveHTML($child);
diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
index 11ffd3791d4b9..4a84e01a525c5 100644
--- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
+++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
@@ -69,7 +69,7 @@ public function __construct($inputTimezone = null, $outputTimezone = null, $form
// The pipe in the parser pattern only works as of PHP 5.3.7
// See http://bugs.php.net/54316
$this->parseUsingPipe = null === $parseUsingPipe
- ? version_compare(phpversion(), '5.3.7', '>=')
+ ? PHP_VERSION_ID >= 50307
: $parseUsingPipe;
// See http://php.net/manual/en/datetime.createfromformat.php
diff --git a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php
index 9d2f774c04e7f..7e38d22f23d5b 100644
--- a/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php
+++ b/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php
@@ -70,7 +70,7 @@ public function isCsrfTokenValid($intention, $token)
*/
protected function getSessionId()
{
- if (version_compare(PHP_VERSION, '5.4', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
if (PHP_SESSION_NONE === session_status()) {
session_start();
}
diff --git a/src/Symfony/Component/Form/FormEvents.php b/src/Symfony/Component/Form/FormEvents.php
index 2bdd585251b1a..54c72271c71e5 100644
--- a/src/Symfony/Component/Form/FormEvents.php
+++ b/src/Symfony/Component/Form/FormEvents.php
@@ -16,26 +16,57 @@
final class FormEvents
{
/**
+ * The PRE_SUBMIT event is dispatched at the beginning of the Form::submit() method.
+ *
+ * It can be used to:
+ * - Change data from the request, before submitting the data to the form.
+ * - Add or remove form fields, before submitting the data to the form.
+ * The event listener method receives a Symfony\Component\Form\FormEvent instance.
+ *
* @Event
*/
const PRE_SUBMIT = 'form.pre_bind';
/**
+ * The SUBMIT event is dispatched just before the Form::submit() method
+ * transforms back the normalized data to the model and view data.
+ *
+ * It can be used to change data from the normalized representation of the data.
+ * The event listener method receives a Symfony\Component\Form\FormEvent instance.
+ *
* @Event
*/
const SUBMIT = 'form.bind';
/**
+ * The FormEvents::POST_SUBMIT event is dispatched after the Form::submit()
+ * once the model and view data have been denormalized.
+ *
+ * It can be used to fetch data after denormalization.
+ * The event listener method receives a Symfony\Component\Form\FormEvent instance.
+ *
* @Event
*/
const POST_SUBMIT = 'form.post_bind';
/**
+ * The FormEvents::PRE_SET_DATA event is dispatched at the beginning of the Form::setData() method.
+ *
+ * It can be used to:
+ * - Modify the data given during pre-population;
+ * - Modify a form depending on the pre-populated data (adding or removing fields dynamically).
+ * The event listener method receives a Symfony\Component\Form\FormEvent instance.
+ *
* @Event
*/
const PRE_SET_DATA = 'form.pre_set_data';
/**
+ * The FormEvents::POST_SET_DATA event is dispatched at the end of the Form::setData() method.
+ *
+ * This event is mostly here for reading data after having pre-populated the form.
+ * The event listener method receives a Symfony\Component\Form\FormEvent instance.
+ *
* @Event
*/
const POST_SET_DATA = 'form.post_set_data';
diff --git a/src/Symfony/Component/Form/Resources/translations/validators.az.xlf b/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
new file mode 100644
index 0000000000000..69e447385acda
--- /dev/null
+++ b/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Bu formada əlavə sahə olmamalıdır.
+
+
+
+ Yüklənən fayl çox böyükdür. Lütfən daha kiçik fayl yükləyin.
+
+
+
+ CSRF nişanı yanlışdır. Lütfen formanı yenidən göndərin.
+
+
+
+
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
index d6a6568b86a90..dbcdad0f96bdf 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
@@ -60,7 +60,7 @@ public function dataProvider()
);
// This test will fail < 5.3.9 - see https://bugs.php.net/51994
- if (version_compare(phpversion(), '5.3.9', '>=')) {
+ if (PHP_VERSION_ID >= 50309) {
$data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
}
@@ -111,7 +111,7 @@ public function testTransformExpectsDateTime()
*/
public function testReverseTransformUsingPipe($format, $input, $output)
{
- if (version_compare(phpversion(), '5.3.7', '<')) {
+ if (PHP_VERSION_ID < 50307) {
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php
index a99b544406fca..3cf62f8db3081 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php
@@ -49,7 +49,7 @@ public function testGenerateCsrfTokenOnUnstartedSession()
{
session_id('touti');
- if (!version_compare(PHP_VERSION, '5.4', '>=')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('This test requires PHP >= 5.4');
}
diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index f2a5ceb9951fa..9299f928fb51e 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -379,7 +379,6 @@ public function send()
fastcgi_finish_request();
} elseif ('cli' !== PHP_SAPI) {
static::closeOutputBuffers(0, true);
- flush();
}
return $this;
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
index 22acdecf61047..0319e0f802fab 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php
@@ -17,7 +17,7 @@
* @see http://php.net/sessionhandler
*/
-if (version_compare(phpversion(), '5.4.0', '>=')) {
+if (PHP_VERSION_ID >= 50400) {
class NativeSessionHandler extends \SessionHandler
{
}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php
index c43c9d05feb0b..d49c36cae5876 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/WriteCheckSessionHandler.php
@@ -52,17 +52,17 @@ public function destroy($sessionId)
/**
* {@inheritdoc}
*/
- public function gc($maxLifetime)
+ public function gc($maxlifetime)
{
- return $this->wrappedSessionHandler->gc($maxLifetime);
+ return $this->wrappedSessionHandler->gc($maxlifetime);
}
/**
* {@inheritdoc}
*/
- public function open($savePath, $sessionId)
+ public function open($savePath, $sessionName)
{
- return $this->wrappedSessionHandler->open($savePath, $sessionId);
+ return $this->wrappedSessionHandler->open($savePath, $sessionName);
}
/**
@@ -80,12 +80,12 @@ public function read($sessionId)
/**
* {@inheritdoc}
*/
- public function write($sessionId, $sessionData)
+ public function write($sessionId, $data)
{
- if (isset($this->readSessions[$sessionId]) && $sessionData === $this->readSessions[$sessionId]) {
+ if (isset($this->readSessions[$sessionId]) && $data === $this->readSessions[$sessionId]) {
return true;
}
- return $this->wrappedSessionHandler->write($sessionId, $sessionData);
+ return $this->wrappedSessionHandler->write($sessionId, $data);
}
}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index f15ced587dc07..b1766503f18a9 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -100,7 +100,7 @@ public function __construct(array $options = array(), $handler = null, MetadataB
session_cache_limiter(''); // disable by default because it's managed by HeaderBag (if used)
ini_set('session.use_cookies', 1);
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
session_register_shutdown();
} else {
register_shutdown_function('session_write_close');
@@ -130,11 +130,11 @@ public function start()
return true;
}
- if (version_compare(phpversion(), '5.4.0', '>=') && \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.');
}
- if (version_compare(phpversion(), '5.4.0', '<') && isset($_SESSION) && session_id()) {
+ if (PHP_VERSION_ID < 50400 && 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
throw new \RuntimeException('Failed to start the session: already started by PHP ($_SESSION is set).');
}
@@ -366,13 +366,13 @@ public function setSaveHandler($saveHandler = null)
if (!$saveHandler instanceof AbstractProxy && $saveHandler instanceof \SessionHandlerInterface) {
$saveHandler = new SessionHandlerProxy($saveHandler);
} elseif (!$saveHandler instanceof AbstractProxy) {
- $saveHandler = version_compare(phpversion(), '5.4.0', '>=') ?
+ $saveHandler = PHP_VERSION_ID >= 50400 ?
new SessionHandlerProxy(new \SessionHandler()) : new NativeProxy();
}
$this->saveHandler = $saveHandler;
if ($this->saveHandler instanceof \SessionHandlerInterface) {
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
session_set_save_handler($this->saveHandler, false);
} else {
session_set_save_handler(
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
index 0b7e5648c0f1f..a46355aac4cb4 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php
@@ -72,7 +72,7 @@ public function isWrapper()
*/
public function isActive()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
return $this->active = \PHP_SESSION_ACTIVE === session_status();
}
@@ -93,7 +93,7 @@ public function isActive()
*/
public function setActive($flag)
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
throw new \LogicException('This method is disabled in PHP 5.4.0+');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
index 20cefabf497bc..3f96bdf025732 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php
@@ -27,7 +27,7 @@ public function testConstruct()
{
$storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir()));
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName());
$this->assertEquals('files', ini_get('session.save_handler'));
} else {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
index 7880615db0be5..8fba843b7dd56 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php
@@ -28,7 +28,7 @@ public function testConstruct()
// note for PHPUnit optimisers - the use of assertTrue/False
// here is deliberate since the tests do not require the classes to exist - drak
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->assertFalse($handler instanceof \SessionHandler);
$this->assertTrue($handler instanceof NativeSessionHandler);
} else {
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 4870115caa64c..ca8d28e337e34 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -164,7 +164,7 @@ public function testSetSaveHandlerException()
public function testSetSaveHandler53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -186,7 +186,7 @@ public function testSetSaveHandler53()
public function testSetSaveHandler54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
@@ -211,7 +211,7 @@ public function testSetSaveHandler54()
*/
public function testStartedOutside53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -234,7 +234,7 @@ public function testStartedOutside53()
*/
public function testCanStartOutside54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
index 0510f3fe9a5a8..e712632589bf6 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php
@@ -60,7 +60,7 @@ protected function getStorage()
public function testPhpSession53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -84,7 +84,7 @@ public function testPhpSession53()
public function testPhpSession54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
index f8ac39c94c1d3..1df28cf1a2c92 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php
@@ -87,7 +87,7 @@ public function testIsWrapper()
public function testIsActivePhp53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -99,7 +99,7 @@ public function testIsActivePhp53()
*/
public function testIsActivePhp54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
@@ -110,7 +110,7 @@ public function testIsActivePhp54()
public function testSetActivePhp53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -126,7 +126,7 @@ public function testSetActivePhp53()
*/
public function testSetActivePhp54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
@@ -149,7 +149,7 @@ public function testName()
*/
public function testNameExceptionPhp53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -163,7 +163,7 @@ public function testNameExceptionPhp53()
*/
public function testNameExceptionPhp54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
@@ -187,7 +187,7 @@ public function testId()
*/
public function testIdExceptionPhp53()
{
- if (version_compare(phpversion(), '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.3 only.');
}
@@ -201,7 +201,7 @@ public function testIdExceptionPhp53()
*/
public function testIdExceptionPhp54()
{
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('Test skipped, for PHP 5.4 only.');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
index 74d841906025b..be9b110d02e10 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php
@@ -52,7 +52,7 @@ public function testOpen()
$this->assertFalse($this->proxy->isActive());
$this->proxy->open('name', 'id');
- if (version_compare(phpversion(), '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->assertTrue($this->proxy->isActive());
} else {
$this->assertFalse($this->proxy->isActive());
diff --git a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
index d9eaa68f49ae7..d11615c56c7b8 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/SaveSessionListener.php
@@ -47,7 +47,7 @@ class SaveSessionListener implements EventSubscriberInterface
{
public function onKernelResponse(FilterResponseEvent $event)
{
- if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
+ if (!$event->isMasterRequest()) {
return;
}
diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
index e9bece022532a..e4ee7cea22805 100644
--- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
+++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
@@ -11,10 +11,6 @@
namespace Symfony\Component\HttpKernel\Fragment;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Templating\EngineInterface;
@@ -111,11 +107,16 @@ public function render($uri, Request $request, array $options = array())
}
$renderedAttributes = '';
if (count($attributes) > 0) {
+ if (PHP_VERSION_ID >= 50400) {
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
+ } else {
+ $flags = ENT_QUOTES;
+ }
foreach ($attributes as $attribute => $value) {
$renderedAttributes .= sprintf(
' %s="%s"',
- htmlspecialchars($attribute, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset, false),
- htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, $this->charset, false)
+ htmlspecialchars($attribute, $flags, $this->charset, false),
+ htmlspecialchars($value, $flags, $this->charset, false)
);
}
}
diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
index ed769d24219eb..fe70ae5d5e844 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -181,7 +181,7 @@ public function testGetArguments()
$request->attributes->set('foobar', 'foobar');
$controller = array(new self(), 'controllerMethod3');
- if (version_compare(PHP_VERSION, '5.3.16', '==')) {
+ if (PHP_VERSION_ID === 50316) {
$this->markTestSkipped('PHP 5.3.16 has a major bug in the Reflection sub-system');
} else {
try {
diff --git a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php
index 2af08157353f1..6a79340c695e4 100644
--- a/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php
+++ b/src/Symfony/Component/Intl/Data/Bundle/Writer/JsonBundleWriter.php
@@ -35,7 +35,7 @@ public function write($path, $locale, $data)
}
});
- if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
// Use JSON_PRETTY_PRINT so that we can see what changed in Git diffs
file_put_contents(
$path.'/'.$locale.'.json',
diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
index dcd418bbb7d83..32d01c4f1f09e 100644
--- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
@@ -200,7 +200,7 @@ public function format($timestamp)
{
// intl allows timestamps to be passed as arrays - we don't
if (is_array($timestamp)) {
- $message = version_compare(PHP_VERSION, '5.3.4', '>=') ?
+ $message = PHP_VERSION_ID >= 50304 ?
'Only integer Unix timestamps and DateTime objects are supported' :
'Only integer Unix timestamps are supported';
@@ -209,11 +209,11 @@ public function format($timestamp)
// behave like the intl extension
$argumentError = null;
- if (version_compare(PHP_VERSION, '5.3.4', '<') && !is_int($timestamp)) {
+ if (PHP_VERSION_ID < 50304 && !is_int($timestamp)) {
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value ';
- } elseif (version_compare(PHP_VERSION, '5.3.4', '>=') && !is_int($timestamp) && !$timestamp instanceof \DateTime) {
+ } elseif (PHP_VERSION_ID >= 50304 && !is_int($timestamp) && !$timestamp instanceof \DateTime) {
$argumentError = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object';
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=') && !is_int($timestamp)) {
+ if (PHP_VERSION_ID >= 50500 && !is_int($timestamp)) {
$argumentError = sprintf('datefmt_format: string \'%s\' is not numeric, which would be required for it to be a valid date', $timestamp);
}
}
@@ -227,7 +227,7 @@ public function format($timestamp)
}
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
- if (version_compare(PHP_VERSION, '5.3.4', '>=') && $timestamp instanceof \DateTime) {
+ if (PHP_VERSION_ID >= 50304 && $timestamp instanceof \DateTime) {
$timestamp = $timestamp->getTimestamp();
}
@@ -376,7 +376,7 @@ public function getTimeZoneId()
}
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
return date_default_timezone_get();
}
}
@@ -541,7 +541,7 @@ public function setTimeZoneId($timeZoneId)
{
if (null === $timeZoneId) {
// In PHP 5.5 if $timeZoneId is null it fallbacks to `date_default_timezone_get()` method
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$timeZoneId = date_default_timezone_get();
} else {
// TODO: changes were made to ext/intl in PHP 5.4.4 release that need to be investigated since it will
diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
index aaed431562195..13fad0793dcb0 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -854,10 +854,7 @@ private function getInt64Value($value)
// The negative PHP_INT_MAX was being converted to float
if (
$value == self::$int32Range['negative'] &&
- (
- (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) ||
- version_compare(PHP_VERSION, '5.4.4', '>=')
- )
+ ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404)
) {
return (int) $value;
}
@@ -870,10 +867,7 @@ private function getInt64Value($value)
// A 32 bit integer was being generated instead of a 64 bit integer
if (
($value > self::$int32Range['positive'] || $value < self::$int32Range['negative']) &&
- (
- (version_compare(PHP_VERSION, '5.3.14', '<')) ||
- (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
- )
+ (PHP_VERSION_ID < 50314 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404))
) {
$value = (-2147483648 - ($value % -2147483648)) * ($value / abs($value));
}
diff --git a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
index 73d6c20821032..69575289cdd9f 100644
--- a/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
+++ b/src/Symfony/Component/Intl/Tests/Data/Bundle/Writer/JsonBundleWriterTest.php
@@ -34,7 +34,7 @@ class JsonBundleWriterTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- if (version_compare(PHP_VERSION, '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$this->markTestSkipped('This test requires at least PHP 5.4.0.');
}
@@ -47,7 +47,7 @@ protected function setUp()
protected function tearDown()
{
- if (version_compare(PHP_VERSION, '5.4.0', '<')) {
+ if (PHP_VERSION_ID < 50400) {
return;
}
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
index 2c6f5558fffa2..dd4e4cd129b51 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -37,7 +37,7 @@ public function testConstructorDefaultTimeZone()
$formatter = $this->getDateFormatter('en', IntlDateFormatter::MEDIUM, IntlDateFormatter::SHORT);
// In PHP 5.5 default timezone depends on `date_default_timezone_get()` method
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$this->assertEquals(date_default_timezone_get(), $formatter->getTimeZoneId());
} else {
$this->assertNull($formatter->getTimeZoneId());
@@ -238,7 +238,7 @@ public function formatProvider()
);
// As of PHP 5.3.4, IntlDateFormatter::format() accepts DateTime instances
- if (version_compare(PHP_VERSION, '5.3.4', '>=')) {
+ if (PHP_VERSION_ID >= 50304) {
$dateTime = new \DateTime('@0');
/* general, DateTime */
@@ -269,7 +269,7 @@ public function testFormatIllegalArgumentError($pattern, $timestamp, $errorMessa
public function formatErrorProvider()
{
// With PHP 5.5 IntlDateFormatter accepts empty values ('0')
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
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'),
);
@@ -277,7 +277,7 @@ public function formatErrorProvider()
$message = 'datefmt_format: takes either an array or an integer timestamp value : U_ILLEGAL_ARGUMENT_ERROR';
- if (version_compare(PHP_VERSION, '5.3.4', '>=')) {
+ if (PHP_VERSION_ID >= 50304) {
$message = 'datefmt_format: takes either an array or an integer timestamp value or a DateTime object: U_ILLEGAL_ARGUMENT_ERROR';
}
@@ -326,7 +326,7 @@ public function formatWithTimezoneProvider()
);
// As of PHP 5.5, intl ext no longer fallbacks invalid time zones to UTC
- if (!version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID < 50500) {
// When time zone not exists, uses UTC by default
$data[] = array(0, 'Foo/Bar', '1970-01-01 00:00:00');
$data[] = array(0, 'UTC+04:30', '1970-01-01 00:00:00');
@@ -340,7 +340,7 @@ public function testFormatWithGmtTimezone()
{
$formatter = $this->getDefaultDateFormatter('zzzz');
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$formatter->setTimeZone('GMT+03:00');
} else {
$formatter->setTimeZoneId('GMT+03:00');
@@ -353,7 +353,7 @@ public function testFormatWithGmtTimeZoneAndMinutesOffset()
{
$formatter = $this->getDefaultDateFormatter('zzzz');
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$formatter->setTimeZone('GMT+00:30');
} else {
$formatter->setTimeZoneId('GMT+00:30');
@@ -366,7 +366,7 @@ public function testFormatWithNonStandardTimezone()
{
$formatter = $this->getDefaultDateFormatter('zzzz');
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$formatter->setTimeZone('Pacific/Fiji');
} else {
$formatter->setTimeZoneId('Pacific/Fiji');
@@ -388,7 +388,7 @@ public function testFormatWithConstructorTimezone()
public function testFormatWithTimezoneFromEnvironmentVariable()
{
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$this->markTestSkipped('IntlDateFormatter in PHP 5.5 no longer depends on TZ environment.');
}
@@ -411,7 +411,7 @@ public function testFormatWithTimezoneFromEnvironmentVariable()
public function testFormatWithTimezoneFromPhp()
{
- if (!version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID < 50500) {
$this->markTestSkipped('Only in PHP 5.5 IntlDateFormatter depends on default timezone (`date_default_timezone_get()`).');
}
@@ -842,7 +842,7 @@ public function testSetTimeZoneId($timeZoneId, $expectedTimeZoneId)
{
$formatter = $this->getDefaultDateFormatter();
- if (version_compare(PHP_VERSION, '5.5.0-dev', '>=')) {
+ if (PHP_VERSION_ID >= 50500) {
$formatter->setTimeZone($timeZoneId);
} else {
$formatter->setTimeZoneId($timeZoneId);
diff --git a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
index 68235a5429ed6..2e7544b39e008 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
@@ -57,7 +57,7 @@ public function testFormatWithUnsupportedTimestampArgument()
} catch (\Exception $e) {
$this->assertInstanceOf('Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException', $e);
- if (version_compare(PHP_VERSION, '5.3.4', '>=')) {
+ if (PHP_VERSION_ID >= 50304) {
$this->assertStringEndsWith('Only integer Unix timestamps and DateTime objects are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
} else {
$this->assertStringEndsWith('Only integer Unix timestamps are supported. Please install the "intl" extension for full localization capabilities.', $e->getMessage());
diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
index c1414392fc78b..c4e7c927728b1 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -689,10 +689,7 @@ public function testParseTypeInt64With32BitIntegerInPhp32Bit()
// Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
// The negative PHP_INT_MAX was being converted to float
- if (
- (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) ||
- version_compare(PHP_VERSION, '5.4.4', '>=')
- ) {
+ if ((PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50314) || PHP_VERSION_ID >= 50404) {
$this->assertInternalType('int', $parsedValue);
} else {
$this->assertInternalType('float', $parsedValue);
@@ -749,10 +746,7 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit()
// 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
- if (
- (version_compare(PHP_VERSION, '5.3.14', '<')) ||
- (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
- ) {
+ 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).');
} else {
$this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
@@ -763,10 +757,7 @@ public function testParseTypeInt64With64BitIntegerInPhp64Bit()
// 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
- if (
- (version_compare(PHP_VERSION, '5.3.14', '<')) ||
- (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
- ) {
+ 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).');
} else {
$this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.az.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.az.xlf
new file mode 100644
index 0000000000000..a974ed0f024c8
--- /dev/null
+++ b/src/Symfony/Component/Security/Core/Resources/translations/security.az.xlf
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+ Doğrulama istisnası baş verdi.
+
+
+
+ Doğrulama məlumatları tapılmadı.
+
+
+
+ Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.
+
+
+
+ Yanlış məlumat.
+
+
+
+ Kuki başqası tərəfindən istifadə edilib.
+
+
+
+ Resurs istəyi üçün imtiyaz yoxdur.
+
+
+
+ Yanlış CSRF nişanı.
+
+
+
+ Dərləmə istifadə müddəti bitib.
+
+
+
+ Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.
+
+
+
+ Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.
+
+
+
+ Nişan tapılmadı.
+
+
+
+ İstifadəçi adı tapılmadı.
+
+
+
+ Hesabın istifadə müddəti bitib.
+
+
+
+ Məlumatların istifadə müddəti bitib.
+
+
+
+ Hesab qeyri-aktiv edilib.
+
+
+
+ Hesab kilitlənib.
+
+
+
+
diff --git a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
index 2213dc5d6b0c6..2f7b845acd158 100644
--- a/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Encoder/BCryptPasswordEncoderTest.php
@@ -66,7 +66,7 @@ public function testValidation()
private function skipIfPhpVersionIsNotSupported()
{
- if (version_compare(phpversion(), '5.3.7', '<')) {
+ if (PHP_VERSION_ID < 50307) {
$this->markTestSkipped('Requires PHP >= 5.3.7');
}
}
diff --git a/src/Symfony/Component/Security/Core/Util/SecureRandom.php b/src/Symfony/Component/Security/Core/Util/SecureRandom.php
index 841b9af38b886..aefc88854a648 100644
--- a/src/Symfony/Component/Security/Core/Util/SecureRandom.php
+++ b/src/Symfony/Component/Security/Core/Util/SecureRandom.php
@@ -43,7 +43,7 @@ public function __construct($seedFile = null, LoggerInterface $logger = null)
$this->logger = $logger;
// determine whether to use OpenSSL
- if (defined('PHP_WINDOWS_VERSION_BUILD') && version_compare(PHP_VERSION, '5.3.4', '<')) {
+ if (defined('PHP_WINDOWS_VERSION_BUILD') && PHP_VERSION_ID < 50304) {
$this->useOpenSsl = false;
} elseif (!function_exists('openssl_random_pseudo_bytes')) {
if (null !== $this->logger) {
diff --git a/src/Symfony/Component/Security/Resources/translations/security.az.xlf b/src/Symfony/Component/Security/Resources/translations/security.az.xlf
new file mode 100644
index 0000000000000..a974ed0f024c8
--- /dev/null
+++ b/src/Symfony/Component/Security/Resources/translations/security.az.xlf
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+ Doğrulama istisnası baş verdi.
+
+
+
+ Doğrulama məlumatları tapılmadı.
+
+
+
+ Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.
+
+
+
+ Yanlış məlumat.
+
+
+
+ Kuki başqası tərəfindən istifadə edilib.
+
+
+
+ Resurs istəyi üçün imtiyaz yoxdur.
+
+
+
+ Yanlış CSRF nişanı.
+
+
+
+ Dərləmə istifadə müddəti bitib.
+
+
+
+ Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.
+
+
+
+ Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.
+
+
+
+ Nişan tapılmadı.
+
+
+
+ İstifadəçi adı tapılmadı.
+
+
+
+ Hesabın istifadə müddəti bitib.
+
+
+
+ Məlumatların istifadə müddəti bitib.
+
+
+
+ Hesab qeyri-aktiv edilib.
+
+
+
+ Hesab kilitlənib.
+
+
+
+
diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
index c1c625b431d38..277e04fac3c60 100644
--- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
+++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
@@ -99,7 +99,7 @@ public function decode($data, $format, array $context = array())
$recursionDepth = $context['json_decode_recursion_depth'];
$options = $context['json_decode_options'];
- if (version_compare(PHP_VERSION, '5.4.0') >= 0) {
+ if (PHP_VERSION_ID >= 50400) {
$decodedData = json_decode($data, $associative, $recursionDepth, $options);
} else {
$decodedData = json_decode($data, $associative, $recursionDepth);
diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php
index 98906eb5b0117..6cc26a318432d 100644
--- a/src/Symfony/Component/Templating/PhpEngine.php
+++ b/src/Symfony/Component/Templating/PhpEngine.php
@@ -17,10 +17,6 @@
use Symfony\Component\Templating\Helper\HelperInterface;
use Symfony\Component\Templating\Loader\LoaderInterface;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
/**
* PhpEngine is an engine able to render PHP templates.
*
@@ -462,6 +458,11 @@ public function getGlobals()
protected function initializeEscapers()
{
$that = $this;
+ if (PHP_VERSION_ID >= 50400) {
+ $flags = ENT_QUOTES | ENT_SUBSTITUTE;
+ } else {
+ $flags = ENT_QUOTES;
+ }
$this->escapers = array(
'html' =>
@@ -472,10 +473,10 @@ protected function initializeEscapers()
*
* @return string the escaped value
*/
- function ($value) use ($that) {
+ function ($value) use ($that, $flags) {
// Numbers and Boolean values get turned into strings which can cause problems
// with type comparisons (e.g. === or is_int() etc).
- return is_string($value) ? htmlspecialchars($value, ENT_QUOTES | ENT_SUBSTITUTE, $that->getCharset(), false) : $value;
+ return is_string($value) ? htmlspecialchars($value, $flags, $that->getCharset(), false) : $value;
},
'js' =>
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf
new file mode 100644
index 0000000000000..add868cd42b40
--- /dev/null
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf
@@ -0,0 +1,227 @@
+
+
+
+
+
+
+ Bu dəyər false olmalıdır.
+
+
+
+ Bu dəyər true olmalıdır.
+
+
+
+ Bu dəyərin tipi {{ type }} olmalıdır.
+
+
+
+ Bu dəyər boş olmalıdır.
+
+
+
+ Seçdiyiniz dəyər düzgün bir seçim değil.
+
+
+
+ Ən az {{ limit }} seçim qeyd edilməlidir.
+
+
+
+ Ən çox {{ limit }} seçim qeyd edilməlidir.
+
+
+
+ Təqdim edilən dəyərlərdən bir və ya bir neçəsi yanlışdır.
+
+
+
+ Bu sahə gözlənilmirdi.
+
+
+
+ Bu sahə əksikdir.
+
+
+
+ Bu dəyər düzgün bir tarix deyil.
+
+
+
+ Bu dəyər düzgün bir tarixsaat deyil.
+
+
+
+ Bu dəyər düzgün bir e-poçt adresi deyil.
+
+
+
+ Fayl tapılmadı.
+
+
+
+ Fayl oxunabilən deyil.
+
+
+
+ Fayl çox böyükdür ({{ size }} {{ suffix }}). İcazə verilən maksimum fayl ölçüsü {{ limit }} {{ suffix }}.
+
+
+
+ Faylın mime tipi yanlışdr ({{ type }}). İcazə verilən mime tipləri {{ types }}.
+
+
+
+ Bu dəyər {{ limit }} və ya altında olmalıdır.
+
+
+
+ Bu dəyər çox uzundur. {{ limit }} və ya daha az simvol olmalıdır.
+
+
+
+ Bu dəyər {{ limit }} veya daha fazla olmalıdır.
+
+
+
+ Bu dəyər çox qısadır. {{ limit }} və ya daha çox simvol olmalıdır.
+
+
+
+ Bu dəyər boş olmamalıdır.
+
+
+
+ Bu dəyər boş olmamalıdır.
+
+
+
+ Bu dəyər boş olmamalıdır.
+
+
+
+ Bu dəyər doğru deyil.
+
+
+
+ Bu dəyər doğru bir saat deyil.
+
+
+
+ Bu dəyər doğru bir URL değil.
+
+
+
+ İki dəyər eyni olmalıdır.
+
+
+
+ Fayl çox böyükdür. İcazə verilən ən böyük fayl ölçüsü {{ limit }} {{ suffix }}.
+
+
+
+ Fayl çox böyükdür.
+
+
+
+ Fayl yüklənəbilmir.
+
+
+
+ Bu dəyər rəqəm olmalıdır.
+
+
+
+ Bu fayl düzgün bir şəkil deyil.
+
+
+
+ Bu düzgün bir IP adresi deyil.
+
+
+
+ Bu dəyər düzgün bir dil deyil.
+
+
+
+ Bu dəyər düzgün bir dil deyil.
+
+
+
+ Bu dəyər düzgün bir ölkə deyil.
+
+
+
+ Bu dəyər hal-hazırda istifadədədir.
+
+
+
+ Şəklin ölçüsü hesablana bilmir.
+
+
+
+ Şəklin genişliyi çox böyükdür ({{ width }}px). İcazə verilən ən böyük genişlik {{ max_width }}px.
+
+
+
+ Şəklin genişliyi çox kiçikdir ({{ width }}px). Ən az {{ min_width }}px olmalıdır.
+
+
+
+ Şəklin yüksəkliyi çox böyükdür ({{ height }}px). İcazə verilən ən böyük yüksəklik {{ max_height }}px.
+
+
+
+ Şəklin yüksəkliyi çox kiçikdir ({{ height }}px). Ən az {{ min_height }}px olmalıdır.
+
+
+
+ Bu dəyər istifadəçinin hazırkı parolu olmalıdır.
+
+
+
+ Bu dəyər tam olaraq {{ limit }} simvol olmaldır.
+
+
+
+ Fayl qismən yükləndi.
+
+
+
+ Fayl yüklənmədi.
+
+
+
+ php.ini'də müvəqqəti qovluq quraşdırılmayıb.
+
+
+
+ Müvəqqəti fayl diskə yazıla bilmir.
+
+
+
+ Bir PHP əlavəsi faylın yüklənməsinə mane oldu.
+
+
+
+ Bu kolleksiyada {{ limit }} və ya daha çox element olmalıdır.
+
+
+
+ Bu kolleksiyada {{ limit }} və ya daha az element olmalıdır.
+
+
+
+ Bu kolleksiyada tam olaraq {{ limit }} element olmalıdır.
+
+
+
+ Yanlış kart nömrəsi.
+
+
+
+ Dəstəklənməyən kart tipi və ya yanlış kart nömrəsi.
+
+
+
+
diff --git a/src/Symfony/Component/Yaml/Exception/ParseException.php b/src/Symfony/Component/Yaml/Exception/ParseException.php
index ff01d6b9a69cc..f5b5e6b4566c0 100644
--- a/src/Symfony/Component/Yaml/Exception/ParseException.php
+++ b/src/Symfony/Component/Yaml/Exception/ParseException.php
@@ -11,11 +11,6 @@
namespace Symfony\Component\Yaml\Exception;
-if (!defined('JSON_UNESCAPED_UNICODE')) {
- define('JSON_UNESCAPED_SLASHES', 64);
- define('JSON_UNESCAPED_UNICODE', 256);
-}
-
/**
* Exception class thrown when an error occurs during parsing.
*
@@ -130,7 +125,12 @@ private function updateRepr()
}
if (null !== $this->parsedFile) {
- $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
+ if (PHP_VERSION_ID >= 50400) {
+ $jsonOptions = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE;
+ } else {
+ $jsonOptions = 0;
+ }
+ $this->message .= sprintf(' in %s', json_encode($this->parsedFile, $jsonOptions));
}
if ($this->parsedLine >= 0) {
diff --git a/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php b/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php
index 289965e8d967e..8c2b1a49a93f3 100644
--- a/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParseExceptionTest.php
@@ -19,7 +19,7 @@ class ParseExceptionTest extends \PHPUnit_Framework_TestCase
public function testGetMessage()
{
$exception = new ParseException('Error message', 42, 'foo: bar', '/var/www/app/config.yml');
- if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
+ if (PHP_VERSION_ID >= 50400) {
$message = 'Error message in "/var/www/app/config.yml" at line 42 (near "foo: bar")';
} else {
$message = 'Error message in "\\/var\\/www\\/app\\/config.yml" at line 42 (near "foo: bar")';
@@ -27,4 +27,16 @@ public function testGetMessage()
$this->assertEquals($message, $exception->getMessage());
}
+
+ public function testGetMessageWithUnicodeInFilename()
+ {
+ $exception = new ParseException('Error message', 42, 'foo: bar', 'äöü.yml');
+ if (PHP_VERSION_ID >= 50400) {
+ $message = 'Error message in "äöü.yml" at line 42 (near "foo: bar")';
+ } else {
+ $message = 'Error message in "\u00e4\u00f6\u00fc.yml" at line 42 (near "foo: bar")';
+ }
+
+ $this->assertEquals($message, $exception->getMessage());
+ }
}