diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index d1e70153dd..14520c1c6f 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);
@@ -86,6 +88,13 @@ UPGRADE FROM 2.x to 3.0
$table->render();
```
+### DependencyInjection
+
+ * The methods `Definition::setFactoryClass()`,
+ `Definition::setFactoryMethod()`, and `Definition::setFactoryService()` have
+ been removed in favor of `Definition::setFactory()`. Services defined using
+ YAML or XML use the same syntax as configurators.
+
### EventDispatcher
* The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface`
@@ -150,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:
@@ -169,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:
@@ -187,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:
@@ -245,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
@@ -254,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
@@ -273,7 +285,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
namespace Acme\FooBundle\Controller;
class DemoController
@@ -288,7 +300,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
namespace Acme\FooBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
@@ -363,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:
@@ -378,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`.
@@ -395,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
@@ -549,7 +567,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Cache\ApcCache;
$cache = new ApcCache('symfony.validator');
@@ -557,7 +575,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Cache\DoctrineCache;
use Doctrine\Common\Cache\ApcCache;
@@ -599,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;
@@ -641,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;
@@ -665,7 +683,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$validator->validate($object, 'Strict');
$validator->validateValue($value, new NotNull());
@@ -673,7 +691,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
$validator->validate($object, null, 'Strict');
$validator->validate($value, new NotNull());
@@ -683,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'))
@@ -694,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);
```
@@ -713,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;
```
@@ -730,7 +748,7 @@ UPGRADE FROM 2.x to 3.0
Example:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\TraversalStrategy;
public function getTraversalStrategy()
@@ -744,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;
```
@@ -759,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;
```
@@ -783,7 +801,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\ClassBasedInterface;
class MyClassMetadata implements ClassBasedInterface
@@ -794,7 +812,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ClassMetadataInterface;
class MyClassMetadata implements ClassMetadataInterface
@@ -807,7 +825,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ElementMetadata;
class MyMetadata extends ElementMetadata
@@ -817,7 +835,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\GenericMetadata;
class MyMetadata extends GenericMetadata
@@ -830,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;
```
@@ -858,7 +876,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$context->addViolationAt('property', 'The value {{ value }} is invalid.', array(
'{{ value }}' => $invalidValue,
));
@@ -866,7 +884,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
$context->buildViolation('The value {{ value }} is invalid.')
->atPath('property')
->setParameter('{{ value }}', $invalidValue)
@@ -878,13 +896,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$context->validate($object);
```
After:
- ```
+ ```php
$context->getValidator()
->inContext($context)
->validate($object);
@@ -900,13 +918,13 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
$metadata = $context->getMetadataFactory()->getMetadataFor($myClass);
```
After:
- ```
+ ```php
$metadata = $context->getValidator()->getMetadataFor($myClass);
```
@@ -921,7 +939,7 @@ UPGRADE FROM 2.x to 3.0
Before:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\ClassMetadataFactory;
$factory = new ClassMetadataFactory($loader);
@@ -929,7 +947,7 @@ UPGRADE FROM 2.x to 3.0
After:
- ```
+ ```php
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
$factory = new LazyLoadingMetadataFactory($loader);
@@ -947,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();
```
@@ -977,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 0bb2bc3a85..689f140d09 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 d0ac455639..35b64dc5e9 100644
--- a/composer.json
+++ b/composer.json
@@ -70,7 +70,7 @@
"doctrine/dbal": "~2.2",
"doctrine/orm": "~2.2,>=2.2.3",
"monolog/monolog": "~1.3",
- "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 6aa820d6b3..23fcd88be8 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 0ec48ee036..cf7f1f576a 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.
*
@@ -176,7 +172,13 @@ class CodeExtension extends \Twig_Extension
$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 ed568055db..5f8ae11211 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
@@ -66,7 +66,7 @@ class FormThemeTest extends \PHPUnit_Framework_TestCase
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 f58da75784..60ef9edfb9 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
@@ -263,7 +263,7 @@ class SearchAndRenderBlockNodeTest extends \PHPUnit_Framework_TestCase
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 e02637f237..df5eb559d8 100644
--- a/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php
@@ -38,7 +38,7 @@ class TransNodeTest extends \PHPUnit_Framework_TestCase
}
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 @@ class TransNodeTest extends \PHPUnit_Framework_TestCase
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 64957858c1..475dbeadc0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
@@ -30,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;
}
@@ -45,7 +45,7 @@ class ServerRunCommand extends ContainerAwareCommand
$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')
@@ -91,6 +91,10 @@ EOF
$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));
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
index e925bcaa54..4aeb20c09c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php
@@ -13,10 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Templating\Helper;
use Symfony\Component\Templating\Helper\Helper;
-if (!defined('ENT_SUBSTITUTE')) {
- define('ENT_SUBSTITUTE', 8);
-}
-
/**
* CodeHelper.
*
@@ -170,7 +166,13 @@ class CodeHelper extends Helper
}
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 cc45d79c70..b270955ea3 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -349,8 +349,11 @@ class SecurityExtension extends Extension
;
}
+ // 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);
@@ -362,11 +365,6 @@ class SecurityExtension extends Extension
// 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));
@@ -386,11 +384,10 @@ class SecurityExtension extends Extension
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 0000000000..e4d5bc30f3
--- /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 0000000000..f4247ad050
--- /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 0000000000..76abc3d262
--- /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 0000000000..e1d3280570
--- /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 0000000000..23acde45a5
--- /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 41ecde703b..f86ec326af 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SecurityRoutingIntegrationTest.php
@@ -30,7 +30,7 @@ class SecurityRoutingIntegrationTest extends WebTestCase
*/
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 @@ class SecurityRoutingIntegrationTest extends WebTestCase
*/
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 0000000000..c6fd207dd1
--- /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 @@ class ClassMapGenerator
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 7b71854da3..587f36902f 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 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase
*/
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 be2385ed97..9853bcb08e 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
@@ -104,7 +104,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase
)),
);
- 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 4b58e7352a..946e1be424 100644
--- a/src/Symfony/Component/Config/ConfigCache.php
+++ b/src/Symfony/Component/Config/ConfigCache.php
@@ -90,7 +90,7 @@ class ConfigCache
* @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 f979fa7db2..d02c14dca5 100644
--- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php
@@ -205,7 +205,7 @@ class TextDescriptor extends Descriptor
*/
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 83cb972813..c9c60e578a 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/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php
index f58667696e..95538b28f2 100644
--- a/src/Symfony/Component/Debug/ErrorHandler.php
+++ b/src/Symfony/Component/Debug/ErrorHandler.php
@@ -126,7 +126,7 @@ class ErrorHandler
if (self::$stackedErrorLevels) {
self::$stackedErrors[] = func_get_args();
} else {
- if (version_compare(PHP_VERSION, '5.4', '<')) {
+ if (PHP_VERSION_ID < 50400) {
$stack = array_map(
function ($row) {
unset($row['args']);
diff --git a/src/Symfony/Component/Debug/ExceptionHandler.php b/src/Symfony/Component/Debug/ExceptionHandler.php
index e85c4745fe..d684cd2b91 100644
--- a/src/Symfony/Component/Debug/ExceptionHandler.php
+++ b/src/Symfony/Component/Debug/ExceptionHandler.php
@@ -15,10 +15,6 @@ use Symfony\Component\HttpFoundation\Response;
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.
*
@@ -356,6 +352,11 @@ EOF;
*/
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]) {
@@ -363,7 +364,7 @@ EOF;
} elseif ('array' === $item[0]) {
$formattedValue = sprintf("array(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
} elseif ('string' === $item[0]) {
- $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset));
+ $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], $flags, $this->charset));
} elseif ('null' === $item[0]) {
$formattedValue = 'null';
} elseif ('boolean' === $item[0]) {
@@ -371,7 +372,7 @@ EOF;
} elseif ('resource' === $item[0]) {
$formattedValue = 'resource';
} else {
- $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset), true));
+ $formattedValue = str_replace("\n", '', var_export(htmlspecialchars((string) $item[1], $flags, $this->charset), true));
}
$result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $key, $formattedValue);
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index 1d9c258b5e..19eb9c6a84 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -546,7 +546,7 @@ class Crawler extends \SplObjectStorage
$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 11ffd3791d..4a84e01a52 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 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
// 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 9d2f774c04..7e38d22f23 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 @@ class DefaultCsrfProvider implements CsrfProviderInterface
*/
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 2bdd585251..54c72271c7 100644
--- a/src/Symfony/Component/Form/FormEvents.php
+++ b/src/Symfony/Component/Form/FormEvents.php
@@ -16,26 +16,57 @@ namespace Symfony\Component\Form;
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 0000000000..69e447385a
--- /dev/null
+++ b/src/Symfony/Component/Form/Resources/translations/validators.az.xlf
@@ -0,0 +1,19 @@
+
+
+
+
+
+ This form should not contain extra fields.
+ Bu formada əlavə sahə olmamalıdır.
+
+
+ The uploaded file was too large. Please try to upload a smaller file.
+ Yüklənən fayl çox böyükdür. Lütfən daha kiçik fayl yükləyin.
+
+
+ The CSRF token is invalid. Please try to resubmit the form.
+ 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 d6a6568b86..dbcdad0f96 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 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
);
// 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 @@ class DateTimeToStringTransformerTest extends DateTimeTestCase
*/
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 a99b544406..3cf62f8db3 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 @@ class DefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
{
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 f2a5ceb995..9299f928fb 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -379,7 +379,6 @@ class Response
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 22acdecf61..0319e0f802 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 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
* @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/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index f15ced587d..b1766503f1 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -100,7 +100,7 @@ class NativeSessionStorage implements SessionStorageInterface
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 @@ class NativeSessionStorage implements SessionStorageInterface
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 @@ class NativeSessionStorage implements SessionStorageInterface
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 0b7e5648c0..a46355aac4 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 @@ abstract class AbstractProxy
*/
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 @@ abstract class AbstractProxy
*/
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 20cefabf49..3f96bdf025 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 @@ class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase
{
$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 7880615db0..8fba843b7d 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 @@ class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase
// 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 4870115caa..ca8d28e337 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 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
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 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
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 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
*/
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 0510f3fe9a..e712632589 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 @@ class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
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 @@ class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
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 f8ac39c94c..1df28cf1a2 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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 @@ class AbstractProxyTest extends \PHPUnit_Framework_TestCase
*/
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 74d8419060..be9b110d02 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 @@ class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase
$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/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php
index e9bece0225..e4ee7cea22 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 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
}
$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 0631ab660e..a7f35e6339 100644
--- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
@@ -181,7 +181,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
$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 2af0815735..6a79340c69 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 @@ class JsonBundleWriter implements BundleWriterInterface
}
});
- 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 dcd418bbb7..32d01c4f1f 100644
--- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
+++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php
@@ -200,7 +200,7 @@ class IntlDateFormatter
{
// 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 @@ class IntlDateFormatter
// 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 @@ class IntlDateFormatter
}
// 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 @@ class IntlDateFormatter
}
// 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 @@ class IntlDateFormatter
{
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 aaed431562..13fad0793d 100644
--- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
+++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php
@@ -854,10 +854,7 @@ class NumberFormatter
// 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 @@ class NumberFormatter
// 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 73d6c20821..69575289cd 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 @@ class JsonBundleWriterTest extends \PHPUnit_Framework_TestCase
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 2c6f5558ff..dd4e4cd129 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/AbstractIntlDateFormatterTest.php
@@ -37,7 +37,7 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
$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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
);
// 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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
$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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
);
// 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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
{
$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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
{
$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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
{
$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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
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 @@ abstract class AbstractIntlDateFormatterTest extends \PHPUnit_Framework_TestCase
{
$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 68235a5429..2e7544b39e 100644
--- a/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/DateFormatter/IntlDateFormatterTest.php
@@ -57,7 +57,7 @@ class IntlDateFormatterTest extends AbstractIntlDateFormatterTest
} 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 c1414392fc..c4e7c92772 100644
--- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
+++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php
@@ -689,10 +689,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
// 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 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
// 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 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
// 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 0000000000..a974ed0f02
--- /dev/null
+++ b/src/Symfony/Component/Security/Core/Resources/translations/security.az.xlf
@@ -0,0 +1,71 @@
+
+
+
+
+
+ An authentication exception occurred.
+ Doğrulama istisnası baş verdi.
+
+
+ Authentication credentials could not be found.
+ Doğrulama məlumatları tapılmadı.
+
+
+ Authentication request could not be processed due to a system problem.
+ Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.
+
+
+ Invalid credentials.
+ Yanlış məlumat.
+
+
+ Cookie has already been used by someone else.
+ Kuki başqası tərəfindən istifadə edilib.
+
+
+ Not privileged to request the resource.
+ Resurs istəyi üçün imtiyaz yoxdur.
+
+
+ Invalid CSRF token.
+ Yanlış CSRF nişanı.
+
+
+ Digest nonce has expired.
+ Dərləmə istifadə müddəti bitib.
+
+
+ No authentication provider found to support the authentication token.
+ Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.
+
+
+ No session available, it either timed out or cookies are not enabled.
+ Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.
+
+
+ No token could be found.
+ Nişan tapılmadı.
+
+
+ Username could not be found.
+ İstifadəçi adı tapılmadı.
+
+
+ Account has expired.
+ Hesabın istifadə müddəti bitib.
+
+
+ Credentials have expired.
+ Məlumatların istifadə müddəti bitib.
+
+
+ Account is disabled.
+ Hesab qeyri-aktiv edilib.
+
+
+ Account is locked.
+ 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 2213dc5d6b..2f7b845acd 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 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase
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 841b9af38b..aefc88854a 100644
--- a/src/Symfony/Component/Security/Core/Util/SecureRandom.php
+++ b/src/Symfony/Component/Security/Core/Util/SecureRandom.php
@@ -43,7 +43,7 @@ final class SecureRandom implements SecureRandomInterface
$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 0000000000..a974ed0f02
--- /dev/null
+++ b/src/Symfony/Component/Security/Resources/translations/security.az.xlf
@@ -0,0 +1,71 @@
+
+
+
+
+
+ An authentication exception occurred.
+ Doğrulama istisnası baş verdi.
+
+
+ Authentication credentials could not be found.
+ Doğrulama məlumatları tapılmadı.
+
+
+ Authentication request could not be processed due to a system problem.
+ Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.
+
+
+ Invalid credentials.
+ Yanlış məlumat.
+
+
+ Cookie has already been used by someone else.
+ Kuki başqası tərəfindən istifadə edilib.
+
+
+ Not privileged to request the resource.
+ Resurs istəyi üçün imtiyaz yoxdur.
+
+
+ Invalid CSRF token.
+ Yanlış CSRF nişanı.
+
+
+ Digest nonce has expired.
+ Dərləmə istifadə müddəti bitib.
+
+
+ No authentication provider found to support the authentication token.
+ Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.
+
+
+ No session available, it either timed out or cookies are not enabled.
+ Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.
+
+
+ No token could be found.
+ Nişan tapılmadı.
+
+
+ Username could not be found.
+ İstifadəçi adı tapılmadı.
+
+
+ Account has expired.
+ Hesabın istifadə müddəti bitib.
+
+
+ Credentials have expired.
+ Məlumatların istifadə müddəti bitib.
+
+
+ Account is disabled.
+ Hesab qeyri-aktiv edilib.
+
+
+ Account is locked.
+ Hesab kilitlənib.
+
+
+
+
diff --git a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
index 60f80428d0..7343fa028d 100644
--- a/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
+++ b/src/Symfony/Component/Serializer/Encoder/JsonDecode.php
@@ -99,7 +99,7 @@ class JsonDecode implements DecoderInterface
$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 98906eb5b0..6cc26a3184 100644
--- a/src/Symfony/Component/Templating/PhpEngine.php
+++ b/src/Symfony/Component/Templating/PhpEngine.php
@@ -17,10 +17,6 @@ use Symfony\Component\Templating\Storage\StringStorage;
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 @@ class PhpEngine implements EngineInterface, \ArrayAccess
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 @@ class PhpEngine implements EngineInterface, \ArrayAccess
*
* @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 0000000000..add868cd42
--- /dev/null
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.az.xlf
@@ -0,0 +1,227 @@
+
+
+
+
+
+ This value should be false.
+ Bu dəyər false olmalıdır.
+
+
+ This value should be true.
+ Bu dəyər true olmalıdır.
+
+
+ This value should be of type {{ type }}.
+ Bu dəyərin tipi {{ type }} olmalıdır.
+
+
+ This value should be blank.
+ Bu dəyər boş olmalıdır.
+
+
+ The value you selected is not a valid choice.
+ Seçdiyiniz dəyər düzgün bir seçim değil.
+
+
+ You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.
+ Ən az {{ limit }} seçim qeyd edilməlidir.
+
+
+ You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.
+ Ən çox {{ limit }} seçim qeyd edilməlidir.
+
+
+ One or more of the given values is invalid.
+ Təqdim edilən dəyərlərdən bir və ya bir neçəsi yanlışdır.
+
+
+ This field was not expected.
+ Bu sahə gözlənilmirdi.
+
+
+ This field is missing.
+ Bu sahə əksikdir.
+
+
+ This value is not a valid date.
+ Bu dəyər düzgün bir tarix deyil.
+
+
+ This value is not a valid datetime.
+ Bu dəyər düzgün bir tarixsaat deyil.
+
+
+ This value is not a valid email address.
+ Bu dəyər düzgün bir e-poçt adresi deyil.
+
+
+ The file could not be found.
+ Fayl tapılmadı.
+
+
+ The file is not readable.
+ Fayl oxunabilən deyil.
+
+
+ The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.
+ Fayl çox böyükdür ({{ size }} {{ suffix }}). İcazə verilən maksimum fayl ölçüsü {{ limit }} {{ suffix }}.
+
+
+ The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.
+ Faylın mime tipi yanlışdr ({{ type }}). İcazə verilən mime tipləri {{ types }}.
+
+
+ This value should be {{ limit }} or less.
+ Bu dəyər {{ limit }} və ya altında olmalıdır.
+
+
+ This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.
+ Bu dəyər çox uzundur. {{ limit }} və ya daha az simvol olmalıdır.
+
+
+ This value should be {{ limit }} or more.
+ Bu dəyər {{ limit }} veya daha fazla olmalıdır.
+
+
+ This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.
+ Bu dəyər çox qısadır. {{ limit }} və ya daha çox simvol olmalıdır.
+
+
+ This value should not be blank.
+ Bu dəyər boş olmamalıdır.
+
+
+ This value should not be null.
+ Bu dəyər boş olmamalıdır.
+
+
+ This value should be null.
+ Bu dəyər boş olmamalıdır.
+
+
+ This value is not valid.
+ Bu dəyər doğru deyil.
+
+
+ This value is not a valid time.
+ Bu dəyər doğru bir saat deyil.
+
+
+ This value is not a valid URL.
+ Bu dəyər doğru bir URL değil.
+
+
+ The two values should be equal.
+ İki dəyər eyni olmalıdır.
+
+
+ The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.
+ Fayl çox böyükdür. İcazə verilən ən böyük fayl ölçüsü {{ limit }} {{ suffix }}.
+
+
+ The file is too large.
+ Fayl çox böyükdür.
+
+
+ The file could not be uploaded.
+ Fayl yüklənəbilmir.
+
+
+ This value should be a valid number.
+ Bu dəyər rəqəm olmalıdır.
+
+
+ This file is not a valid image.
+ Bu fayl düzgün bir şəkil deyil.
+
+
+ This is not a valid IP address.
+ Bu düzgün bir IP adresi deyil.
+
+
+ This value is not a valid language.
+ Bu dəyər düzgün bir dil deyil.
+
+
+ This value is not a valid locale.
+ Bu dəyər düzgün bir dil deyil.
+
+
+ This value is not a valid country.
+ Bu dəyər düzgün bir ölkə deyil.
+
+
+ This value is already used.
+ Bu dəyər hal-hazırda istifadədədir.
+
+
+ The size of the image could not be detected.
+ Şəklin ölçüsü hesablana bilmir.
+
+
+ The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.
+ Şəklin genişliyi çox böyükdür ({{ width }}px). İcazə verilən ən böyük genişlik {{ max_width }}px.
+
+
+ The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.
+ Şəklin genişliyi çox kiçikdir ({{ width }}px). Ən az {{ min_width }}px olmalıdır.
+
+
+ The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.
+ Şəklin yüksəkliyi çox böyükdür ({{ height }}px). İcazə verilən ən böyük yüksəklik {{ max_height }}px.
+
+
+ The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.
+ Şəklin yüksəkliyi çox kiçikdir ({{ height }}px). Ən az {{ min_height }}px olmalıdır.
+
+
+ This value should be the user's current password.
+ Bu dəyər istifadəçinin hazırkı parolu olmalıdır.
+
+
+ This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.
+ Bu dəyər tam olaraq {{ limit }} simvol olmaldır.
+
+
+ The file was only partially uploaded.
+ Fayl qismən yükləndi.
+
+
+ No file was uploaded.
+ Fayl yüklənmədi.
+
+
+ No temporary folder was configured in php.ini.
+ php.ini'də müvəqqəti qovluq quraşdırılmayıb.
+
+
+ Cannot write temporary file to disk.
+ Müvəqqəti fayl diskə yazıla bilmir.
+
+
+ A PHP extension caused the upload to fail.
+ Bir PHP əlavəsi faylın yüklənməsinə mane oldu.
+
+
+ This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.
+ Bu kolleksiyada {{ limit }} və ya daha çox element olmalıdır.
+
+
+ This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.
+ Bu kolleksiyada {{ limit }} və ya daha az element olmalıdır.
+
+
+ This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.
+ Bu kolleksiyada tam olaraq {{ limit }} element olmalıdır.
+
+
+ Invalid card number.
+ Yanlış kart nömrəsi.
+
+
+ Unsupported card type or invalid card number.
+ 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 ff01d6b9a6..f5b5e6b456 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 @@ class ParseException extends RuntimeException
}
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 289965e8d9..8c2b1a49a9 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 @@ class ParseExceptionTest extends \PHPUnit_Framework_TestCase
$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());
+ }
}