Merge branch '2.3' into 2.5

* 2.3:
  [SecurityBundle] Authentication entry point is only registered with firewall exception listener, not with authentication listeners
  be smarter when guessing the document root
  Azerbaijani locale
  Fixed grammar error in docblock
  Adjust upgrade file rendering
  [Bridge/Propel1] Changed deps to accepts all upcoming propel1 versions
  compare version using PHP_VERSION_ID
  [Form] Add doc for FormEvents
  don't override internal PHP constants

Conflicts:
	UPGRADE-3.0.md
	src/Symfony/Bundle/FrameworkBundle/Command/ServerRunCommand.php
	src/Symfony/Component/Debug/ErrorHandler.php
	src/Symfony/Component/HttpFoundation/Response.php
This commit is contained in:
Fabien Potencier 2014-11-20 14:22:25 +01:00
commit 891ebe594e
63 changed files with 832 additions and 220 deletions

View File

@ -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.

View File

@ -1,6 +1,6 @@
<?php
if (version_compare(PHP_VERSION, '5.4', '>=') && 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();

View File

@ -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"

View File

@ -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"

View File

@ -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('<a href="%s" title="Click to open this file" class="file_link">%s</a>', 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('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
}
return $text;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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('<error>The given document root directory "%s" does not exist</error>', $documentRoot));

View File

@ -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('<a href="%s" title="Click to open this file" class="file_link">%s</a>', 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('<a href="%s" title="Click to open this file" class="file_link">%s</a>', htmlspecialchars($link, $flags, $this->charset), $text);
}
return $text;

View File

@ -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) {

View File

@ -0,0 +1,26 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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');
}
}

View File

@ -0,0 +1,18 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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
{
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="firewall_entry_point.entry_point.stub"
class="Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub"
/>
</services>
</container>

View File

@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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);
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* 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');
}
}

View File

@ -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');
}

View File

@ -0,0 +1,7 @@
<?php
return array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\FirewallEntryPointBundle(),
);

View File

@ -0,0 +1,33 @@
framework:
secret: test
csrf_protection:
enabled: true
router: { resource: "%kernel.root_dir%/%kernel.test_case%/routing.yml" }
validation: { enabled: true, enable_annotations: true }
form: ~
test: ~
default_locale: en
session:
storage_id: session.storage.mock_file
profiler: { only_exceptions: false }
services:
logger: { class: Symfony\Component\HttpKernel\Log\NullLogger }
security:
firewalls:
secure:
pattern: ^/secure/
http_basic: { realm: "Secure Gateway API" }
entry_point: firewall_entry_point.entry_point.stub
default:
anonymous: ~
access_control:
- { path: ^/secure/, roles: ROLE_SECURE }
providers:
in_memory:
memory:
users:
john: { password: doe, roles: [ROLE_SECURE] }
encoders:
Symfony\Component\Security\Core\User\User: plaintext

View File

@ -0,0 +1,2 @@
secure_resource:
path: /secure/resource

View File

@ -11,8 +11,10 @@
namespace Symfony\Component\ClassLoader;
if (!defined('T_TRAIT')) {
define('T_TRAIT', 0);
if (PHP_VERSION_ID >= 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]) {

View File

@ -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;

View File

@ -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',

View File

@ -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)
{

View File

@ -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));
}

View File

@ -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;

View File

@ -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']);

View File

@ -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("<em>array</em>(%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 = '<em>null</em>';
} elseif ('boolean' === $item[0]) {
@ -371,7 +372,7 @@ EOF;
} elseif ('resource' === $item[0]) {
$formattedValue = '<em>resource</em>';
} 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);

View File

@ -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);

View File

@ -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

View File

@ -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();
}

View File

@ -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';

View File

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="28">
<source>This form should not contain extra fields.</source>
<target>Bu formada əlavə sahə olmamalıdır.</target>
</trans-unit>
<trans-unit id="29">
<source>The uploaded file was too large. Please try to upload a smaller file.</source>
<target>Yüklənən fayl çox böyükdür. Lütfən daha kiçik fayl yükləyin.</target>
</trans-unit>
<trans-unit id="30">
<source>The CSRF token is invalid. Please try to resubmit the form.</source>
<target>CSRF nişanı yanlışdır. Lütfen formanı yenidən göndərin.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -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.');
}

View File

@ -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');
}

View File

@ -379,7 +379,6 @@ class Response
fastcgi_finish_request();
} elseif ('cli' !== PHP_SAPI) {
static::closeOutputBuffers(0, true);
flush();
}
return $this;

View File

@ -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
{
}

View File

@ -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(

View File

@ -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+');
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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.');
}

View File

@ -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.');
}

View File

@ -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.');
}

View File

@ -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());

View File

@ -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)
);
}
}

View File

@ -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 {

View File

@ -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',

View File

@ -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

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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());

View File

@ -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).');

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>An authentication exception occurred.</source>
<target>Doğrulama istisnası baş verdi.</target>
</trans-unit>
<trans-unit id="2">
<source>Authentication credentials could not be found.</source>
<target>Doğrulama məlumatları tapılmadı.</target>
</trans-unit>
<trans-unit id="3">
<source>Authentication request could not be processed due to a system problem.</source>
<target>Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.</target>
</trans-unit>
<trans-unit id="4">
<source>Invalid credentials.</source>
<target>Yanlış məlumat.</target>
</trans-unit>
<trans-unit id="5">
<source>Cookie has already been used by someone else.</source>
<target>Kuki başqası tərəfindən istifadə edilib.</target>
</trans-unit>
<trans-unit id="6">
<source>Not privileged to request the resource.</source>
<target>Resurs istəyi üçün imtiyaz yoxdur.</target>
</trans-unit>
<trans-unit id="7">
<source>Invalid CSRF token.</source>
<target>Yanlış CSRF nişanı.</target>
</trans-unit>
<trans-unit id="8">
<source>Digest nonce has expired.</source>
<target>Dərləmə istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="9">
<source>No authentication provider found to support the authentication token.</source>
<target>Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.</target>
</trans-unit>
<trans-unit id="10">
<source>No session available, it either timed out or cookies are not enabled.</source>
<target>Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.</target>
</trans-unit>
<trans-unit id="11">
<source>No token could be found.</source>
<target>Nişan tapılmadı.</target>
</trans-unit>
<trans-unit id="12">
<source>Username could not be found.</source>
<target>İstifadəçi adı tapılmadı.</target>
</trans-unit>
<trans-unit id="13">
<source>Account has expired.</source>
<target>Hesabın istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="14">
<source>Credentials have expired.</source>
<target>Məlumatların istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="15">
<source>Account is disabled.</source>
<target>Hesab qeyri-aktiv edilib.</target>
</trans-unit>
<trans-unit id="16">
<source>Account is locked.</source>
<target>Hesab kilitlənib.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -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');
}
}

View File

@ -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) {

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>An authentication exception occurred.</source>
<target>Doğrulama istisnası baş verdi.</target>
</trans-unit>
<trans-unit id="2">
<source>Authentication credentials could not be found.</source>
<target>Doğrulama məlumatları tapılmadı.</target>
</trans-unit>
<trans-unit id="3">
<source>Authentication request could not be processed due to a system problem.</source>
<target>Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.</target>
</trans-unit>
<trans-unit id="4">
<source>Invalid credentials.</source>
<target>Yanlış məlumat.</target>
</trans-unit>
<trans-unit id="5">
<source>Cookie has already been used by someone else.</source>
<target>Kuki başqası tərəfindən istifadə edilib.</target>
</trans-unit>
<trans-unit id="6">
<source>Not privileged to request the resource.</source>
<target>Resurs istəyi üçün imtiyaz yoxdur.</target>
</trans-unit>
<trans-unit id="7">
<source>Invalid CSRF token.</source>
<target>Yanlış CSRF nişanı.</target>
</trans-unit>
<trans-unit id="8">
<source>Digest nonce has expired.</source>
<target>Dərləmə istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="9">
<source>No authentication provider found to support the authentication token.</source>
<target>Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.</target>
</trans-unit>
<trans-unit id="10">
<source>No session available, it either timed out or cookies are not enabled.</source>
<target>Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.</target>
</trans-unit>
<trans-unit id="11">
<source>No token could be found.</source>
<target>Nişan tapılmadı.</target>
</trans-unit>
<trans-unit id="12">
<source>Username could not be found.</source>
<target>İstifadəçi adı tapılmadı.</target>
</trans-unit>
<trans-unit id="13">
<source>Account has expired.</source>
<target>Hesabın istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="14">
<source>Credentials have expired.</source>
<target>Məlumatların istifadə müddəti bitib.</target>
</trans-unit>
<trans-unit id="15">
<source>Account is disabled.</source>
<target>Hesab qeyri-aktiv edilib.</target>
</trans-unit>
<trans-unit id="16">
<source>Account is locked.</source>
<target>Hesab kilitlənib.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -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);

View File

@ -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' =>

View File

@ -0,0 +1,227 @@
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>This value should be false.</source>
<target>Bu dəyər false olmalıdır.</target>
</trans-unit>
<trans-unit id="2">
<source>This value should be true.</source>
<target>Bu dəyər true olmalıdır.</target>
</trans-unit>
<trans-unit id="3">
<source>This value should be of type {{ type }}.</source>
<target>Bu dəyərin tipi {{ type }} olmalıdır.</target>
</trans-unit>
<trans-unit id="4">
<source>This value should be blank.</source>
<target>Bu dəyər boş olmalıdır.</target>
</trans-unit>
<trans-unit id="5">
<source>The value you selected is not a valid choice.</source>
<target>Seçdiyiniz dəyər düzgün bir seçim değil.</target>
</trans-unit>
<trans-unit id="6">
<source>You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices.</source>
<target>Ən az {{ limit }} seçim qeyd edilməlidir.</target>
</trans-unit>
<trans-unit id="7">
<source>You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices.</source>
<target>Ən çox {{ limit }} seçim qeyd edilməlidir.</target>
</trans-unit>
<trans-unit id="8">
<source>One or more of the given values is invalid.</source>
<target>Təqdim edilən dəyərlərdən bir və ya bir neçəsi yanlışdır.</target>
</trans-unit>
<trans-unit id="9">
<source>This field was not expected.</source>
<target>Bu sahə gözlənilmirdi.</target>
</trans-unit>
<trans-unit id="10">
<source>This field is missing.</source>
<target>Bu sahə əksikdir.</target>
</trans-unit>
<trans-unit id="11">
<source>This value is not a valid date.</source>
<target>Bu dəyər düzgün bir tarix deyil.</target>
</trans-unit>
<trans-unit id="12">
<source>This value is not a valid datetime.</source>
<target>Bu dəyər düzgün bir tarixsaat deyil.</target>
</trans-unit>
<trans-unit id="13">
<source>This value is not a valid email address.</source>
<target>Bu dəyər düzgün bir e-poçt adresi deyil.</target>
</trans-unit>
<trans-unit id="14">
<source>The file could not be found.</source>
<target>Fayl tapılmadı.</target>
</trans-unit>
<trans-unit id="15">
<source>The file is not readable.</source>
<target>Fayl oxunabilən deyil.</target>
</trans-unit>
<trans-unit id="16">
<source>The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}.</source>
<target>Fayl çox böyükdür ({{ size }} {{ suffix }}). İcazə verilən maksimum fayl ölçüsü {{ limit }} {{ suffix }}.</target>
</trans-unit>
<trans-unit id="17">
<source>The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}.</source>
<target>Faylın mime tipi yanlışdr ({{ type }}). İcazə verilən mime tipləri {{ types }}.</target>
</trans-unit>
<trans-unit id="18">
<source>This value should be {{ limit }} or less.</source>
<target>Bu dəyər {{ limit }} və ya altında olmalıdır.</target>
</trans-unit>
<trans-unit id="19">
<source>This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less.</source>
<target>Bu dəyər çox uzundur. {{ limit }} və ya daha az simvol olmalıdır.</target>
</trans-unit>
<trans-unit id="20">
<source>This value should be {{ limit }} or more.</source>
<target>Bu dəyər {{ limit }} veya daha fazla olmalıdır.</target>
</trans-unit>
<trans-unit id="21">
<source>This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more.</source>
<target>Bu dəyər çox qısadır. {{ limit }} və ya daha çox simvol olmalıdır.</target>
</trans-unit>
<trans-unit id="22">
<source>This value should not be blank.</source>
<target>Bu dəyər boş olmamalıdır.</target>
</trans-unit>
<trans-unit id="23">
<source>This value should not be null.</source>
<target>Bu dəyər boş olmamalıdır.</target>
</trans-unit>
<trans-unit id="24">
<source>This value should be null.</source>
<target>Bu dəyər boş olmamalıdır.</target>
</trans-unit>
<trans-unit id="25">
<source>This value is not valid.</source>
<target>Bu dəyər doğru deyil.</target>
</trans-unit>
<trans-unit id="26">
<source>This value is not a valid time.</source>
<target>Bu dəyər doğru bir saat deyil.</target>
</trans-unit>
<trans-unit id="27">
<source>This value is not a valid URL.</source>
<target>Bu dəyər doğru bir URL değil.</target>
</trans-unit>
<trans-unit id="31">
<source>The two values should be equal.</source>
<target>İki dəyər eyni olmalıdır.</target>
</trans-unit>
<trans-unit id="32">
<source>The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}.</source>
<target>Fayl çox böyükdür. İcazə verilən ən böyük fayl ölçüsü {{ limit }} {{ suffix }}.</target>
</trans-unit>
<trans-unit id="33">
<source>The file is too large.</source>
<target>Fayl çox böyükdür.</target>
</trans-unit>
<trans-unit id="34">
<source>The file could not be uploaded.</source>
<target>Fayl yüklənəbilmir.</target>
</trans-unit>
<trans-unit id="35">
<source>This value should be a valid number.</source>
<target>Bu dəyər rəqəm olmalıdır.</target>
</trans-unit>
<trans-unit id="36">
<source>This file is not a valid image.</source>
<target>Bu fayl düzgün bir şəkil deyil.</target>
</trans-unit>
<trans-unit id="37">
<source>This is not a valid IP address.</source>
<target>Bu düzgün bir IP adresi deyil.</target>
</trans-unit>
<trans-unit id="38">
<source>This value is not a valid language.</source>
<target>Bu dəyər düzgün bir dil deyil.</target>
</trans-unit>
<trans-unit id="39">
<source>This value is not a valid locale.</source>
<target>Bu dəyər düzgün bir dil deyil.</target>
</trans-unit>
<trans-unit id="40">
<source>This value is not a valid country.</source>
<target>Bu dəyər düzgün bir ölkə deyil.</target>
</trans-unit>
<trans-unit id="41">
<source>This value is already used.</source>
<target>Bu dəyər hal-hazırda istifadədədir.</target>
</trans-unit>
<trans-unit id="42">
<source>The size of the image could not be detected.</source>
<target>Şəklin ölçüsü hesablana bilmir.</target>
</trans-unit>
<trans-unit id="43">
<source>The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px.</source>
<target>Şəklin genişliyi çox böyükdür ({{ width }}px). İcazə verilən ən böyük genişlik {{ max_width }}px.</target>
</trans-unit>
<trans-unit id="44">
<source>The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px.</source>
<target>Şəklin genişliyi çox kiçikdir ({{ width }}px). Ən az {{ min_width }}px olmalıdır.</target>
</trans-unit>
<trans-unit id="45">
<source>The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px.</source>
<target>Şəklin yüksəkliyi çox böyükdür ({{ height }}px). İcazə verilən ən böyük yüksəklik {{ max_height }}px.</target>
</trans-unit>
<trans-unit id="46">
<source>The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px.</source>
<target>Şəklin yüksəkliyi çox kiçikdir ({{ height }}px). Ən az {{ min_height }}px olmalıdır.</target>
</trans-unit>
<trans-unit id="47">
<source>This value should be the user's current password.</source>
<target>Bu dəyər istifadəçinin hazırkı parolu olmalıdır.</target>
</trans-unit>
<trans-unit id="48">
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>
<target>Bu dəyər tam olaraq {{ limit }} simvol olmaldır.</target>
</trans-unit>
<trans-unit id="49">
<source>The file was only partially uploaded.</source>
<target>Fayl qismən yükləndi.</target>
</trans-unit>
<trans-unit id="50">
<source>No file was uploaded.</source>
<target>Fayl yüklənmədi.</target>
</trans-unit>
<trans-unit id="51">
<source>No temporary folder was configured in php.ini.</source>
<target>php.ini'də müvəqqəti qovluq quraşdırılmayıb.</target>
</trans-unit>
<trans-unit id="52">
<source>Cannot write temporary file to disk.</source>
<target>Müvəqqəti fayl diskə yazıla bilmir.</target>
</trans-unit>
<trans-unit id="53">
<source>A PHP extension caused the upload to fail.</source>
<target>Bir PHP əlavəsi faylın yüklənməsinə mane oldu.</target>
</trans-unit>
<trans-unit id="54">
<source>This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.</source>
<target>Bu kolleksiyada {{ limit }} və ya daha çox element olmalıdır.</target>
</trans-unit>
<trans-unit id="55">
<source>This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.</source>
<target>Bu kolleksiyada {{ limit }} və ya daha az element olmalıdır.</target>
</trans-unit>
<trans-unit id="56">
<source>This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.</source>
<target>Bu kolleksiyada tam olaraq {{ limit }} element olmalıdır.</target>
</trans-unit>
<trans-unit id="57">
<source>Invalid card number.</source>
<target>Yanlış kart nömrəsi.</target>
</trans-unit>
<trans-unit id="58">
<source>Unsupported card type or invalid card number.</source>
<target>Dəstəklənməyən kart tipi və ya yanlış kart nömrəsi.</target>
</trans-unit>
</body>
</file>
</xliff>

View File

@ -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) {

View File

@ -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());
}
}