diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index f723a64439..7465e2d9ee 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -522,6 +522,12 @@ class Configuration implements ConfigurationInterface $rootNode ->children() ->arrayNode('session') + ->validate() + ->ifTrue(function ($v) { + return empty($v['handler_id']) && !empty($v['save_path']); + }) + ->thenInvalid('Session save path is ignored without a handler service') + ->end() ->info('session configuration') ->canBeEnabled() ->children() @@ -547,7 +553,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('gc_divisor')->end() ->scalarNode('gc_probability')->defaultValue(1)->end() ->scalarNode('gc_maxlifetime')->end() - ->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end() + ->scalarNode('save_path')->end() ->integerNode('metadata_update_threshold') ->defaultValue(0) ->info('seconds to wait between 2 session metadata updates') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index e8f42697a0..47eee56b17 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -892,6 +892,11 @@ class FrameworkExtension extends Extension // session handler (the internal callback registered with PHP session management) if (null === $config['handler_id']) { + // If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored + if (isset($config['save_path'])) { + throw new LogicException('Session save path is ignored without a handler service'); + } + // Set the handler class to be null $container->getDefinition('session.storage.native')->replaceArgument(1, null); $container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null); @@ -899,6 +904,10 @@ class FrameworkExtension extends Extension $container->setAlias('session.handler', $config['handler_id'])->setPrivate(true); } + if (!isset($config['save_path'])) { + $config['save_path'] = ini_get('session.save_path'); + } + $container->setParameter('session.save_path', $config['save_path']); $container->setParameter('session.metadata.update_threshold', $config['metadata_update_threshold']); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml index abd0733e0c..63a61efe4b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug.xml @@ -9,6 +9,7 @@ + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php index 4a5001e106..9cc460f749 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -301,7 +301,6 @@ class ConfigurationTest extends TestCase 'cookie_httponly' => true, 'cookie_samesite' => null, 'gc_probability' => 1, - 'save_path' => '%kernel.cache_dir%/sessions', 'metadata_update_threshold' => 0, ], 'request' => [ diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php new file mode 100644 index 0000000000..89841bca43 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/session_savepath.php @@ -0,0 +1,8 @@ +loadFromExtension('framework', [ + 'session' => [ + 'handler_id' => null, + 'save_path' => '/some/path', + ], +]); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml new file mode 100644 index 0000000000..a9ddd8016b --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/session_savepath.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml new file mode 100644 index 0000000000..174ebe5869 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/session_savepath.yml @@ -0,0 +1,4 @@ +framework: + session: + handler_id: null + save_path: /some/path diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index d0d8e0454d..877e79c889 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -561,6 +561,14 @@ abstract class FrameworkExtensionTest extends TestCase $this->assertEquals($expected, array_keys($container->getDefinition('session_listener')->getArgument(0)->getValues())); } + /** + * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException + */ + public function testNullSessionHandlerWithSavePath() + { + $this->createContainerFromFile('session_savepath'); + } + public function testRequest() { $container = $this->createContainerFromFile('full'); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php index bc40f4f8dd..fe7b3e4efd 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php @@ -60,7 +60,7 @@ class ExceptionController $exception = $this->profiler->loadProfile($token)->getCollector('exception')->getException(); $template = $this->getTemplate(); - if (!$this->twig->getLoader()->exists($template)) { + if (!$this->templateExists($template)) { $handler = new ExceptionHandler($this->debug, $this->twig->getCharset(), $this->fileLinkFormat); return new Response($handler->getContent($exception), 200, ['Content-Type' => 'text/html']); diff --git a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php index 9462996f6d..ca1029cb60 100644 --- a/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php +++ b/src/Symfony/Component/Console/CommandLoader/CommandLoaderInterface.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Symfony\Component\Console\Command\Command; diff --git a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php index 753ad0fb70..8000c7d5ec 100644 --- a/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php +++ b/src/Symfony/Component/Console/CommandLoader/ContainerCommandLoader.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Component\Console\CommandLoader; use Psr\Container\ContainerInterface; diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index 655bdd083e..204b46fbb8 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -77,11 +77,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } /** - * Sets style foreground color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setForeground($color = null) { @@ -99,11 +95,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } /** - * Sets style background color. - * - * @param string|null $color The color name - * - * @throws InvalidArgumentException When the color name isn't defined + * {@inheritdoc} */ public function setBackground($color = null) { @@ -126,11 +118,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } /** - * Sets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function setOption($option) { @@ -144,11 +132,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } /** - * Unsets some specific style option. - * - * @param string $option The option name - * - * @throws InvalidArgumentException When the option name isn't defined + * {@inheritdoc} */ public function unsetOption($option) { @@ -175,11 +159,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface } /** - * Applies the style to a given text. - * - * @param string $text The text to style - * - * @return string + * {@inheritdoc} */ public function apply($text) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index 4c7dc4134d..af171c2702 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -21,7 +21,7 @@ interface OutputFormatterStyleInterface /** * Sets style foreground color. * - * @param string $color The color name + * @param string|null $color The color name */ public function setForeground($color = null); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index e5f08e4f62..fd8fc3e665 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -41,6 +41,7 @@ use Symfony\Component\DependencyInjection\Tests\Compiler\Foo; use Symfony\Component\DependencyInjection\Tests\Compiler\Wither; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\ExpressionLanguage\Expression; @@ -1601,6 +1602,20 @@ class ContainerBuilderTest extends TestCase $this->assertSame(['service_container'], array_keys($container->getDefinitions())); } + public function testScalarService() + { + $c = new ContainerBuilder(); + $c->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $c->compile(); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } + public function testWither() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php index e81bf5636f..47e59ab714 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php @@ -295,6 +295,16 @@ class ContainerTest extends TestCase $this->assertTrue($sc->has('foo.baz'), '->has() returns true if a get*Method() is defined'); } + public function testScalarService() + { + $c = new Container(); + + $c->set('foo', 'some value'); + + $this->assertTrue($c->has('foo')); + $this->assertSame('some value', $c->get('foo')); + } + public function testInitialized() { $sc = new ProjectServiceContainer(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 56d29c9f9c..b8686ba2fb 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -33,6 +33,7 @@ use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Compiler\Foo; use Symfony\Component\DependencyInjection\Tests\Compiler\Wither; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ScalarFactory; use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; use Symfony\Component\DependencyInjection\TypedReference; @@ -1226,6 +1227,25 @@ class PhpDumperTest extends TestCase $this->assertSame($foo5, $locator->get('foo5')); } + public function testScalarService() + { + $container = new ContainerBuilder(); + $container->register('foo', 'string') + ->setPublic(true) + ->setFactory([ScalarFactory::class, 'getSomeValue']) + ; + + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(['class' => 'Symfony_DI_PhpDumper_Test_Scalar_Service'])); + + $container = new \Symfony_DI_PhpDumper_Test_Scalar_Service(); + + $this->assertTrue($container->has('foo')); + $this->assertSame('some value', $container->get('foo')); + } + public function testWither() { $container = new ContainerBuilder(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php new file mode 100644 index 0000000000..15646a8d0c --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/ScalarFactory.php @@ -0,0 +1,14 @@ + This form should not contain extra fields. - این فرم نباید فیلد اضافی داشته باشد. + این فرم نباید شامل فیلد اضافه ای باشد. The uploaded file was too large. Please try to upload a smaller file. - فایل بارگذاری شده بسیار بزرگ است. لطفا فایل کوچکتری را بارگزاری کنید. + فایل بارگذاری شده بسیار بزرگ می باشد. لطفا فایل کوچکتری را بارگذاری نمایید. The CSRF token is invalid. Please try to resubmit the form. - مقدار CSRF نامعتبر است. لطفا فرم را مجددا ارسال فرمایید.. + توکن CSRF نامعتبر می باشد. لطفا فرم را مجددا ارسال نمایید. diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index fffe2ab81e..27d5f43b67 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -913,8 +913,8 @@ class Request $pos = strrpos($host, ':'); } - if (false !== $pos) { - return (int) substr($host, $pos + 1); + if (false !== $pos && $port = substr($host, $pos + 1)) { + return (int) $port; } return 'https' === $this->getScheme() ? 443 : 80; diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index ab0dcf6818..20883221d3 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -2303,6 +2303,18 @@ class RequestTest extends TestCase $this->assertSame(443, $request->getPort()); } + + public function testTrustedPortDoesNotDefaultToZero() + { + Request::setTrustedProxies(['1.1.1.1'], Request::HEADER_X_FORWARDED_ALL); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('X-Forwarded-Host', 'test.example.com'); + $request->headers->set('X-Forwarded-Port', ''); + + $this->assertSame(80, $request->getPort()); + } } class RequestContentProxy extends Request diff --git a/src/Symfony/Component/Intl/Resources/bin/autoload.php b/src/Symfony/Component/Intl/Resources/bin/autoload.php index 13e0564781..14167a5f4a 100644 --- a/src/Symfony/Component/Intl/Resources/bin/autoload.php +++ b/src/Symfony/Component/Intl/Resources/bin/autoload.php @@ -12,7 +12,7 @@ $autoload = __DIR__.'/../../vendor/autoload.php'; if (!file_exists($autoload)) { - bailout('You should run "composer install --dev" in the component before running this script.'); + bailout('You should run "composer install" in the component before running this script.'); } require_once $autoload; diff --git a/src/Symfony/Component/Intl/Resources/bin/compile b/src/Symfony/Component/Intl/Resources/bin/compile index a593809604..d66558395d 100755 --- a/src/Symfony/Component/Intl/Resources/bin/compile +++ b/src/Symfony/Component/Intl/Resources/bin/compile @@ -1,8 +1,7 @@ #!/usr/bin/env bash -if [[ $1 == force ]]; then - docker pull jakzal/php-intl -fi; +[[ $1 == force ]] && docker pull jakzal/php-intl +[[ ! -d /tmp/symfony/icu ]] && mkdir -p /tmp/symfony/icu docker run \ -it --rm --name symfony-intl \ diff --git a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php index ce7abe1d25..6443d65dab 100644 --- a/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php +++ b/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php @@ -221,7 +221,7 @@ class MessengerPass implements CompilerPassInterface throw new RuntimeException(sprintf('Invalid handler service "%s": type-hint of argument "$%s" in method "%s::__invoke()" must be a class , "%s" given.', $serviceId, $parameters[0]->getName(), $handlerClass->getName(), $type)); } - return [(string) $parameters[0]->getType()]; + return [$parameters[0]->getType()->getName()]; } private function registerReceivers(ContainerBuilder $container, array $busIds) diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index 7b66ee9aed..e32d14fc4a 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -330,13 +330,14 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer $reflectionClass = new \ReflectionClass($class); $object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes, $format); + $resolvedClass = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object); foreach ($normalizedData as $attribute => $value) { if ($this->nameConverter) { - $attribute = $this->nameConverter->denormalize($attribute, $class, $format, $context); + $attribute = $this->nameConverter->denormalize($attribute, $resolvedClass, $format, $context); } - if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($class, $attribute, $format, $context)) { + if ((false !== $allowedAttributes && !\in_array($attribute, $allowedAttributes)) || !$this->isAllowedAttribute($resolvedClass, $attribute, $format, $context)) { if (!($context[self::ALLOW_EXTRA_ATTRIBUTES] ?? $this->defaultContext[self::ALLOW_EXTRA_ATTRIBUTES])) { $extraAttributes[] = $attribute; } @@ -351,7 +352,7 @@ abstract class AbstractObjectNormalizer extends AbstractNormalizer } } - $value = $this->validateAndDenormalize($class, $attribute, $value, $format, $context); + $value = $this->validateAndDenormalize($resolvedClass, $attribute, $value, $format, $context); try { $this->setAttributeValue($object, $attribute, $value, $format, $context); } catch (InvalidArgumentException $e) { diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php index 645c307c35..20672c39b5 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummyFirstChild.php @@ -15,10 +15,23 @@ class AbstractDummyFirstChild extends AbstractDummy { public $bar; + /** @var DummyFirstChildQuux|null */ + public $quux; + public function __construct($foo = null, $bar = null) { parent::__construct($foo); $this->bar = $bar; } + + public function getQuux(): ?DummyFirstChildQuux + { + return $this->quux; + } + + public function setQuux(DummyFirstChildQuux $quux): void + { + $this->quux = $quux; + } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php index 5a41b9441a..67a72977e2 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/AbstractDummySecondChild.php @@ -15,10 +15,23 @@ class AbstractDummySecondChild extends AbstractDummy { public $baz; + /** @var DummySecondChildQuux|null */ + public $quux; + public function __construct($foo = null, $baz = null) { parent::__construct($foo); $this->baz = $baz; } + + public function getQuux(): ?DummySecondChildQuux + { + return $this->quux; + } + + public function setQuux(DummySecondChildQuux $quux): void + { + $this->quux = $quux; + } } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php new file mode 100644 index 0000000000..7ba39fc346 --- /dev/null +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DummyFirstChildQuux.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests\Fixtures; + +class DummyFirstChildQuux +{ + /** + * @var string + */ + private $value; + + public function __construct(string $value) + { + $this->value = $value; + } + + public function getValue(): string + { + return $this->value; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php b/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php new file mode 100644 index 0000000000..11c4d0eccd --- /dev/null +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/DummySecondChildQuux.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests\Fixtures; + +class DummySecondChildQuux +{ + /** + * @var string + */ + private $value; + + public function __construct(string $value) + { + $this->value = $value; + } + + public function getValue(): string + { + return $this->value; + } +} diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php index 70939567f5..a3586152b4 100644 --- a/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/src/Symfony/Component/Serializer/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -16,13 +16,22 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Type; use Symfony\Component\Serializer\Exception\NotNormalizableValueException; +use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; +use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping; +use Symfony\Component\Serializer\Mapping\ClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; +use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface; use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; +use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\SerializerAwareInterface; use Symfony\Component\Serializer\SerializerInterface; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild; +use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild; +use Symfony\Component\Serializer\Tests\Fixtures\DummySecondChildQuux; class AbstractObjectNormalizerTest extends TestCase { @@ -147,6 +156,39 @@ class AbstractObjectNormalizerTest extends TestCase return $denormalizer; } + public function testDenormalizeWithDiscriminatorMapUsesCorrectClassname() + { + $factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $loaderMock = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock(); + $loaderMock->method('hasMetadataFor')->willReturnMap([ + [ + AbstractDummy::class, + true, + ], + ]); + + $loaderMock->method('getMetadataFor')->willReturnMap([ + [ + AbstractDummy::class, + new ClassMetadata( + AbstractDummy::class, + new ClassDiscriminatorMapping('type', [ + 'first' => AbstractDummyFirstChild::class, + 'second' => AbstractDummySecondChild::class, + ]) + ), + ], + ]); + + $discriminatorResolver = new ClassDiscriminatorFromClassMetadata($loaderMock); + $normalizer = new AbstractObjectNormalizerDummy($factory, null, new PhpDocExtractor(), $discriminatorResolver); + $serializer = new Serializer([$normalizer]); + $normalizer->setSerializer($serializer); + $normalizedData = $normalizer->denormalize(['foo' => 'foo', 'baz' => 'baz', 'quux' => ['value' => 'quux'], 'type' => 'second'], AbstractDummy::class); + + $this->assertInstanceOf(DummySecondChildQuux::class, $normalizedData->quux); + } + /** * Test that additional attributes throw an exception if no metadata factory is specified. * @@ -180,7 +222,7 @@ class AbstractObjectNormalizerDummy extends AbstractObjectNormalizer protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = []) { - return \in_array($attribute, ['foo', 'baz']); + return \in_array($attribute, ['foo', 'baz', 'quux', 'value']); } public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, string $format = null) diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php index a3b931b524..26a94b2f6f 100644 --- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php +++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Serializer\Tests; use Doctrine\Common\Annotations\AnnotationReader; use PHPUnit\Framework\TestCase; +use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; @@ -34,6 +35,7 @@ use Symfony\Component\Serializer\Serializer; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummy; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummyFirstChild; use Symfony\Component\Serializer\Tests\Fixtures\AbstractDummySecondChild; +use Symfony\Component\Serializer\Tests\Fixtures\DummyFirstChildQuux; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberOne; use Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberTwo; @@ -382,6 +384,7 @@ class SerializerTest extends TestCase public function testDeserializeAndSerializeAbstractObjectsWithTheClassMetadataDiscriminatorResolver() { $example = new AbstractDummyFirstChild('foo-value', 'bar-value'); + $example->setQuux(new DummyFirstChildQuux('quux')); $loaderMock = $this->getMockBuilder(ClassMetadataFactoryInterface::class)->getMock(); $loaderMock->method('hasMetadataFor')->willReturnMap([ @@ -405,9 +408,9 @@ class SerializerTest extends TestCase ]); $discriminatorResolver = new ClassDiscriminatorFromClassMetadata($loaderMock); - $serializer = new Serializer([new ObjectNormalizer(null, null, null, null, $discriminatorResolver)], ['json' => new JsonEncoder()]); + $serializer = new Serializer([new ObjectNormalizer(null, null, null, new PhpDocExtractor(), $discriminatorResolver)], ['json' => new JsonEncoder()]); - $jsonData = '{"type":"first","bar":"bar-value","foo":"foo-value"}'; + $jsonData = '{"type":"first","quux":{"value":"quux"},"bar":"bar-value","foo":"foo-value"}'; $deserialized = $serializer->deserialize($jsonData, AbstractDummy::class, 'json'); $this->assertEquals($example, $deserialized); diff --git a/src/Symfony/Component/Translation/Loader/MoFileLoader.php b/src/Symfony/Component/Translation/Loader/MoFileLoader.php index 16a3dfc618..d344c6e21a 100644 --- a/src/Symfony/Component/Translation/Loader/MoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/MoFileLoader.php @@ -111,17 +111,12 @@ class MoFileLoader extends FileLoader $ids = ['singular' => $singularId, 'plural' => $pluralId]; $item = compact('ids', 'translated'); - if (\is_array($item['translated'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = $item['ids']['singular']; if (isset($item['ids']['plural'])) { - $plurals = []; - foreach ($item['translated'] as $plural => $translated) { - $plurals[] = sprintf('{%d} %s', $plural, $translated); - } - $messages[$item['ids']['plural']] = stripcslashes(implode('|', $plurals)); + $id .= '|'.$item['ids']['plural']; } - } elseif (!empty($item['ids']['singular'])) { - $messages[$item['ids']['singular']] = stripcslashes($item['translated']); + $messages[$id] = stripcslashes(implode('|', (array) $item['translated'])); } } diff --git a/src/Symfony/Component/Translation/Loader/PoFileLoader.php b/src/Symfony/Component/Translation/Loader/PoFileLoader.php index 1412a786a7..cf8a4b8553 100644 --- a/src/Symfony/Component/Translation/Loader/PoFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/PoFileLoader.php @@ -126,23 +126,24 @@ class PoFileLoader extends FileLoader */ private function addMessage(array &$messages, array $item) { - if (\is_array($item['translated'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]); + if (!empty($item['ids']['singular'])) { + $id = stripcslashes($item['ids']['singular']); if (isset($item['ids']['plural'])) { - $plurals = $item['translated']; - // PO are by definition indexed so sort by index. - ksort($plurals); - // Make sure every index is filled. - end($plurals); - $count = key($plurals); - // Fill missing spots with '-'. - $empties = array_fill(0, $count + 1, '-'); - $plurals += $empties; - ksort($plurals); - $messages[stripcslashes($item['ids']['plural'])] = stripcslashes(implode('|', $plurals)); + $id .= '|'.stripcslashes($item['ids']['plural']); } - } elseif (!empty($item['ids']['singular'])) { - $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated']); + + $translated = (array) $item['translated']; + // PO are by definition indexed so sort by index. + ksort($translated); + // Make sure every index is filled. + end($translated); + $count = key($translated); + // Fill missing spots with '-'. + $empties = array_fill(0, $count + 1, '-'); + $translated += $empties; + ksort($translated); + + $messages[$id] = stripcslashes(implode('|', $translated)); } } } diff --git a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php index 63de5cebaa..d6adecb173 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/MoFileLoaderTest.php @@ -34,7 +34,10 @@ class MoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/plurals.mo'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => '{0} bar|{1} bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } diff --git a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php index d8e2c1993b..cb94e90a94 100644 --- a/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php +++ b/src/Symfony/Component/Translation/Tests/Loader/PoFileLoaderTest.php @@ -34,7 +34,10 @@ class PoFileLoaderTest extends TestCase $resource = __DIR__.'/../fixtures/plurals.po'; $catalogue = $loader->load($resource, 'en', 'domain1'); - $this->assertEquals(['foo' => 'bar', 'foos' => 'bar|bars'], $catalogue->all('domain1')); + $this->assertEquals([ + 'foo|foos' => 'bar|bars', + '{0} no foos|one foo|%count% foos' => '{0} no bars|one bar|%count% bars', + ], $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals([new FileResource($resource)], $catalogue->getResources()); } @@ -89,10 +92,8 @@ class PoFileLoaderTest extends TestCase $catalogue = $loader->load($resource, 'en', 'domain1'); $messages = $catalogue->all('domain1'); - $this->assertArrayHasKey('escaped "foo"', $messages); - $this->assertArrayHasKey('escaped "foos"', $messages); - $this->assertEquals('escaped "bar"', $messages['escaped "foo"']); - $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foos"']); + $this->assertArrayHasKey('escaped "foo"|escaped "foos"', $messages); + $this->assertEquals('escaped "bar"|escaped "bars"', $messages['escaped "foo"|escaped "foos"']); } public function testSkipFuzzyTranslations() @@ -106,4 +107,16 @@ class PoFileLoaderTest extends TestCase $this->assertArrayNotHasKey('foo2', $messages); $this->assertArrayHasKey('foo3', $messages); } + + public function testMissingPlurals() + { + $loader = new PoFileLoader(); + $resource = __DIR__.'/../fixtures/missing-plurals.po'; + $catalogue = $loader->load($resource, 'en', 'domain1'); + + $this->assertEquals([ + 'foo|foos' => '-|bar|-|bars', + ], $catalogue->all('domain1')); + $this->assertEquals('en', $catalogue->getLocale()); + } } diff --git a/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po new file mode 100644 index 0000000000..3b47fca805 --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/fixtures/missing-plurals.po @@ -0,0 +1,4 @@ +msgid "foo" +msgid_plural "foos" +msgstr[3] "bars" +msgstr[1] "bar" diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo b/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo index 6445e77bea..3945ad95be 100644 Binary files a/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo and b/src/Symfony/Component/Translation/Tests/fixtures/plurals.mo differ diff --git a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po index 439c41ad7f..61d1ba42b4 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/plurals.po +++ b/src/Symfony/Component/Translation/Tests/fixtures/plurals.po @@ -3,3 +3,5 @@ msgid_plural "foos" msgstr[0] "bar" msgstr[1] "bars" +msgid "{0} no foos|one foo|%count% foos" +msgstr "{0} no bars|one bar|%count% bars" diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf index ff1aa7c0b1..2cfcbea4b0 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.fa.xlf @@ -16,19 +16,19 @@ This value should be blank. - این فیلد باید خالی باشد. + این مقدار باید خالی باشد. The value you selected is not a valid choice. - گزینه انتخابی معتبر نیست. + مقدار انتخاب شده شامل گزینه های معتبر نمی باشد. You must select at least {{ limit }} choice.|You must select at least {{ limit }} choices. - باید حداقل {{ limit }} گزینه انتخاب کنید.|باید حداقل {{ limit }} گزینه انتخاب کنید. + باید حداقل {{ limit }} گزینه انتخاب نمایید.|باید حداقل {{ limit }} گزینه انتخاب نمایید. You must select at most {{ limit }} choice.|You must select at most {{ limit }} choices. - حداکثر {{ limit }} گزینه می توانید انتخاب کنید.|حداکثر {{ limit }} گزینه می توانید انتخاب کنید. + حداکثر {{ limit }} گزینه می توانید انتخاب نمایید.|حداکثر {{ limit }} گزینه می توانید انتخاب نمایید. One or more of the given values is invalid. @@ -44,87 +44,87 @@ This value is not a valid date. - این مقدار یک تاریخ معتبر نیست. + این مقدار یک تاریخ معتبر نمی باشد. This value is not a valid datetime. - این مقدار یک تاریخ و زمان معتبر نیست. + این مقدار یک تاریخ و زمان معتبر نمی باشد. This value is not a valid email address. - این یک رایانامه معتبر نیست. + این یک رایانامه معتبر نمی باشد. The file could not be found. - فایل پیدا نشد. + فایل یافت نشد. The file is not readable. - فایل قابلیت خواندن ندارد. + فایل قابلیت خوانده شدن ندارد. The file is too large ({{ size }} {{ suffix }}). Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است({{ size }} {{ suffix }}). حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The mime type of the file is invalid ({{ type }}). Allowed mime types are {{ types }}. - این نوع فایل مجاز نیست({{ type }}). نوع های مجاز {{ types }} هستند. + این نوع فایل مجاز نمی باشد({{ type }}). نوع های مجاز شامل {{ types }} می باشند. This value should be {{ limit }} or less. - این مقدار باید کوچکتر یا مساوی {{ limit }} باشد. + این مقدار باید کوچکتر و یا مساوی {{ limit }} باشد. This value is too long. It should have {{ limit }} character or less.|This value is too long. It should have {{ limit }} characters or less. - بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} است. + بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد.|بسیار طولانی است.حداکثر تعداد حروف مجاز برابر {{ limit }} می باشد. This value should be {{ limit }} or more. - این مقدار باید برابر و یا بیشتر از {{ limit }} باشد. + این مقدار باید بزرگتر و یا مساوی {{ limit }} باشد. This value is too short. It should have {{ limit }} character or more.|This value is too short. It should have {{ limit }} characters or more. - بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد.|بسیار کوتاه است.تعداد حروف باید حداقل {{ limit }} باشد. + مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد.|مقدار وارد شده بسیار کوتاه است.تعداد حروف وارد شده، باید حداقل شامل {{ limit }} کاراکتر باشد. This value should not be blank. - این مقدار نباید تهی باشد. + این مقدار نباید خالی باشد. This value should not be null. - باید مقداری داشته باشد.. + این مقدار باید شامل چیزی باشد. This value should be null. - نباید مقداری داشته باشد. + این مقدار باید شامل چیزی نباشد. This value is not valid. - این مقدار معتبر نیست. + این مقدار معتبر نمی باشد. This value is not a valid time. - این مقدار یک زمان صحیح نیست. + این مقدار یک زمان صحیح نمی باشد. This value is not a valid URL. - این یک URL معتبر نیست. + این مقدار شامل یک URL معتبر نمی باشد. The two values should be equal. - دو مقدار باید برابر باشند. + دو مقدار باید با یکدیگر برابر باشند. The file is too large. Allowed maximum size is {{ limit }} {{ suffix }}. - فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر {{ limit }} {{ suffix }} است. + فایل بیش از اندازه بزرگ است. حداکثر اندازه مجاز برابر با {{ limit }} {{ suffix }} می باشد. The file is too large. - فایل بیش از اندازه بزرگ است. + فایل بیش از اندازه بزرگ می باشد. The file could not be uploaded. - بارگذاری فایل با شکست مواجه شد. + بارگذاری فایل با شکست مواجه گردید. This value should be a valid number. @@ -132,23 +132,23 @@ This file is not a valid image. - این فایل یک تصویر نیست. + این فایل یک تصویر نمی باشد. This is not a valid IP address. - این مقدار یک IP معتبر نیست. + این مقدار یک IP معتبر نمی باشد. This value is not a valid language. - این مقدار یک زبان صحیح نیست. + این مقدار یک زبان صحیح نمی باشد. This value is not a valid locale. - این مقدار یک محل صحیح نیست. + این مقدار یک محل صحیح نمی باشد. This value is not a valid country. - این مقدار یک کشور صحیح نیست. + این مقدار یک کشور صحیح نمی باشد. This value is already used. @@ -156,23 +156,23 @@ The size of the image could not be detected. - اندازه تصویر قابل شناسایی نیست. + اندازه تصویر قابل شناسایی نمی باشد. The image width is too big ({{ width }}px). Allowed maximum width is {{ max_width }}px. - طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px است. + طول تصویر بسیار بزرگ است ({{ width }}px). بشینه طول مجاز {{ max_width }}px می باشد. The image width is too small ({{ width }}px). Minimum width expected is {{ min_width }}px. - طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px است. + طول تصویر بسیار کوچک است ({{ width }}px). کمینه طول موردنظر {{ min_width }}px می باشد. The image height is too big ({{ height }}px). Allowed maximum height is {{ max_height }}px. - ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px است. + ارتفاع تصویر بسیار بزرگ است ({{ height }}px). بشینه ارتفاع مجاز {{ max_height }}px می باشد. The image height is too small ({{ height }}px). Minimum height expected is {{ min_height }}px. - ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px است. + ارتفاع تصویر بسیار کوچک است ({{ height }}px). کمینه ارتفاع موردنظر {{ min_height }}px می باشد. This value should be the user's current password. @@ -184,67 +184,67 @@ The file was only partially uploaded. - فایل به صورت جزیی بارگذاری شده است. + پرونده به صورت جزیی بارگذاری گردیده است. No file was uploaded. - هیچ فایلی بارگذاری نشد. + هیچ پرونده ای بارگذاری نگردیده است. No temporary folder was configured in php.ini. - فولدر موقت در php.ini پیکربندی نشده است. + فولدر موقت در php.ini پیکربندی نگردیده است. Cannot write temporary file to disk. - فایل موقت را نمی توان در دیسک نوشت. + فایل موقتی را نمی توان در دیسک نوشت. A PHP extension caused the upload to fail. - اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه شود. + یک اکستنشن PHP موجب شد که بارگذاری فایل با شکست مواجه گردد. This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more. - این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا بیشتر باشد. + این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد.|این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا بیشتر باشد. This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less. - این مجموعه می بایست دارای حداقل {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای {{ limit }} عنصر یا کمتر باشد. + این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد.|این مجموعه می بایست دارای حداکثر {{ limit }} عنصر یا کمتر باشد. This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements. - این مجموعه می بایست به طور دقیق دارا {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} قلم باشد. + این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد.|این مجموعه می بایست به طور دقیق دارای {{ limit }} عنصر باشد. Invalid card number. - شماره کارت نامعتبر است. + شماره کارت نامعتبر می باشد. Unsupported card type or invalid card number. - نوع کارت پشتیبانی نمی شود یا شماره کارت نامعتبر است. + نوع کارت پشتیبانی نمی شود و یا شماره کارت نامعتبر می باشد. This is not a valid International Bank Account Number (IBAN). - این یک شماره حساب بین المللی بانک (IBAN) درست نیست. + این یک شماره حساب بانک بین المللی معتبر نمی باشد (IBAN). This value is not a valid ISBN-10. - این مقدار یک ISBN-10 درست نیست. + این مقدار یک ISBN-10 معتبر نمی باشد. This value is not a valid ISBN-13. - این مقدار یک ISBN-13 درست نیست. + این مقدار یک ISBN-13 معتبر نمی باشد. This value is neither a valid ISBN-10 nor a valid ISBN-13. - این مقدار یک ISBN-10 درست یا ISBN-13 درست نیست. + این مقدار یک ISBN-10 صحیح و یا ISBN-13 معتبر نمی باشد. This value is not a valid ISSN. - این مقدار یک ISSN درست نیست. + این مقدار یک ISSN معتبر نمی باشد. This value is not a valid currency. - این مقدار یک یکای پول درست نیست. + این مقدار یک واحد پول معتبر نمی باشد. This value should be equal to {{ compared_value }}. @@ -256,11 +256,11 @@ This value should be greater than or equal to {{ compared_value }}. - این مقدار باید بزرگتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید بزرگتر و یا مساوی با {{ compared_value }} باشد. This value should be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار باید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. This value should be less than {{ compared_value }}. @@ -268,7 +268,7 @@ This value should be less than or equal to {{ compared_value }}. - این مقدار باید کمتر یا مساوی با {{ compared_value }} باشد. + این مقدار باید کمتر و یا مساوی با {{ compared_value }} باشد. This value should not be equal to {{ compared_value }}. @@ -276,43 +276,43 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. - این مقدار نباید {{ compared_value_type }} {{ compared_value }} یکی باشد. + این مقدار نباید با {{ compared_value_type }} {{ compared_value }} یکسان باشد. The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد بزرگ است.حداکثر ابعاد مجاز {{ max_ratio }} می باشد. The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. - ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} است. + ابعاد {{ ratio }} عکس بیش از حد کوچک است.حداقل ابعاد مجاز {{ min_ratio }} می باشد. The image is square ({{ width }}x{{ height }}px). Square images are not allowed. - این عکس مربع width }}x{{ height }}px}} می باشد.عکس مربع مجاز نمی باشد. + این تصویر یک مربع width }}x{{ height }}px}} می باشد.تصویر مربع مجاز نمی باشد. The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. - این عکس افقی width }}x{{ height }}px}} می باشد.عکس افقی مجاز نمی باشد. + این تصویر افقی width }}x{{ height }}px}} می باشد.تصویر افقی مجاز نمی باشد. The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. - این عکس عمودی width }}x{{ height }}px}} می باشد.عکس عمودی مجاز نمی باشد. + این تصویر عمودی width }}x{{ height }}px}} می باشد.تصویر عمودی مجاز نمی باشد. An empty file is not allowed. - فایل خالی مجاز نمی باشد. + پرونده خالی مجاز نمی باشد. The host could not be resolved. - هاست قابل حل نیست. + میزبان قابل حل نمی باشد. This value does not match the expected {{ charset }} charset. - این مقدار مورد نظر نمی باشد. مقدار مورد نظر {{ charset }} می باشد. + این مقدار مطابق با مقدار مورد انتظار {{ charset }} نمی باشد. This is not a valid Business Identifier Code (BIC). - این مقدار یک BIC درست نیست. + این مقدار یک BIC معتبر نمی باشد. Error @@ -320,7 +320,7 @@ This is not a valid UUID. - این مقدار یک UUID درست نیست. + این مقدار یک UUID معتبر نمی باشد. This value should be a multiple of {{ compared_value }}. @@ -328,7 +328,7 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. - این BIC با IBAN ارتباط ندارد. + این BIC با IBAN ارتباطی ندارد.