-[Symfony][1] is a **PHP framework** for web applications and a set of reusable
+[Symfony][1] is a **PHP framework** for web and console applications and a set of reusable
**PHP components**. Symfony is used by thousands of web applications (including
BlaBlaCar.com and Spotify.com) and most of the [popular PHP projects][2] (including
Drupal and Magento).
diff --git a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
index abd7cc57b3..4d722c46ec 100644
--- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
@@ -41,7 +41,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
}
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
- $this->sendHeaders = false;
+ self::$sendHeaders = false;
$this->headers = [];
return;
@@ -59,7 +59,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
*/
protected function sendHeader($header, $content)
{
- if (!$this->sendHeaders) {
+ if (!self::$sendHeaders) {
return;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index e6cf770e58..827b306bcf 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -19,6 +19,7 @@ use Symfony\Component\Asset\Package;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
+use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\Form\Form;
use Symfony\Component\HttpClient\HttpClient;
@@ -1173,6 +1174,10 @@ class Configuration implements ConfigurationInterface
->ifTrue(function ($v) { return isset($v['buses']) && \count($v['buses']) > 1 && null === $v['default_bus']; })
->thenInvalid('You must specify the "default_bus" if you define more than one bus.')
->end()
+ ->validate()
+ ->ifTrue(static function ($v): bool { return isset($v['buses']) && null !== $v['default_bus'] && !isset($v['buses'][$v['default_bus']]); })
+ ->then(static function (array $v): void { throw new InvalidConfigurationException(sprintf('The specified default bus "%s" is not configured. Available buses are "%s".', $v['default_bus'], implode('", "', array_keys($v['buses'])))); })
+ ->end()
->children()
->arrayNode('routing')
->normalizeKeys(false)
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index a56a05e741..c49575c898 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -304,7 +304,7 @@ class FrameworkExtension extends Extension
}
if ($this->messengerConfigEnabled = $this->isConfigEnabled($container, $config['messenger'])) {
- $this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['serializer'], $config['validation']);
+ $this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['validation']);
} else {
$container->removeDefinition('console.command.messenger_consume_messages');
$container->removeDefinition('console.command.messenger_debug');
@@ -1696,7 +1696,7 @@ class FrameworkExtension extends Extension
}
}
- private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $serializerConfig, array $validationConfig)
+ private function registerMessengerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader, array $validationConfig)
{
if (!interface_exists(MessageBusInterface::class)) {
throw new LogicException('Messenger support cannot be enabled as the Messenger component is not installed. Try running "composer require symfony/messenger".');
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
index 4698c50593..ec7d286fd3 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
@@ -40,6 +40,11 @@
+
+
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
index a95e649c80..5356ffe486 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php
@@ -329,6 +329,27 @@ class ConfigurationTest extends TestCase
);
}
+ public function testItErrorsWhenDefaultBusDoesNotExist()
+ {
+ $processor = new Processor();
+ $configuration = new Configuration(true);
+
+ $this->expectException(InvalidConfigurationException::class);
+ $this->expectExceptionMessage('The specified default bus "foo" is not configured. Available buses are "bar", "baz".');
+
+ $processor->processConfiguration($configuration, [
+ [
+ 'messenger' => [
+ 'default_bus' => 'foo',
+ 'buses' => [
+ 'bar' => null,
+ 'baz' => null,
+ ],
+ ],
+ ],
+ ]);
+ }
+
protected static function getBundleDefaultConfig()
{
return [
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
index 40d257c335..f38fd6fa58 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
@@ -121,7 +121,7 @@ EOF
continue;
}
- $this->displayLog($input, $output, $clientId, $record);
+ $this->displayLog($output, $clientId, $record);
}
return 0;
@@ -150,7 +150,7 @@ EOF
}
}
- private function displayLog(InputInterface $input, OutputInterface $output, int $clientId, array $record)
+ private function displayLog(OutputInterface $output, int $clientId, array $record)
{
if (isset($record['log_id'])) {
$clientId = unpack('H*', $record['log_id'])[1];
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 94e1024af5..c85860be7f 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -797,7 +797,7 @@ class FilesystemTest extends FilesystemTestCase
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
- // $file does not exists right now: creating "broken" links is a wanted feature
+ // $file does not exist right now: creating "broken" links is a wanted feature
$this->filesystem->symlink($file, $link);
$this->assertTrue(is_link($link));
diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php
index b82314c018..2af869c66d 100644
--- a/src/Symfony/Component/Form/ButtonBuilder.php
+++ b/src/Symfony/Component/Form/ButtonBuilder.php
@@ -63,7 +63,7 @@ class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
if (preg_match('/^([^a-zA-Z0-9_].*)?(.*[^a-zA-Z0-9_\-:].*)?$/D', $name, $matches)) {
if (isset($matches[1])) {
- @trigger_error(sprintf('Using names for buttons that do not start with a lowercase letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), E_USER_DEPRECATED);
+ @trigger_error(sprintf('Using names for buttons that do not start with a letter, a digit, or an underscore is deprecated since Symfony 4.3 and will throw an exception in 5.0 ("%s" given).', $name), E_USER_DEPRECATED);
}
if (isset($matches[2])) {
@trigger_error(sprintf('Using names for buttons that do not contain only letters, digits, underscores ("_"), hyphens ("-") and colons (":") ("%s" given) is deprecated since Symfony 4.3 and will throw an exception in 5.0.', $name), E_USER_DEPRECATED);
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
index 06218e002c..716dcac09b 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
@@ -377,7 +377,9 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
}
// add our cached last-modified validator
- $subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
+ if ($entry->headers->has('Last-Modified')) {
+ $subRequest->headers->set('if_modified_since', $entry->headers->get('Last-Modified'));
+ }
// Add our cached etag validator to the environment.
// We keep the etags from the client to handle the case when the client
diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
index 3ba1449580..8f221f1960 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
@@ -857,6 +857,7 @@ class HttpCacheTest extends HttpCacheTestCase
public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation()
{
$this->setNextResponse(200, [], 'Hello World', function ($request, $response) {
+ $this->assertFalse($request->headers->has('If-Modified-Since'));
$response->headers->set('Cache-Control', 'public');
$response->headers->set('ETag', '"12345"');
if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) {
diff --git a/src/Symfony/Component/Intl/Currencies.php b/src/Symfony/Component/Intl/Currencies.php
index 7459d633cb..c155c8f09f 100644
--- a/src/Symfony/Component/Intl/Currencies.php
+++ b/src/Symfony/Component/Intl/Currencies.php
@@ -46,7 +46,7 @@ final class Currencies extends ResourceBundle
}
/**
- * @throws MissingResourceException if the currency code does not exists
+ * @throws MissingResourceException if the currency code does not exist
*/
public static function getName(string $currency, string $displayLocale = null): string
{
@@ -78,7 +78,7 @@ final class Currencies extends ResourceBundle
}
/**
- * @throws MissingResourceException if the currency code does not exists
+ * @throws MissingResourceException if the currency code does not exist
*/
public static function getSymbol(string $currency, string $displayLocale = null): string
{
@@ -115,7 +115,7 @@ final class Currencies extends ResourceBundle
}
/**
- * @throws MissingResourceException if the numeric code does not exists
+ * @throws MissingResourceException if the numeric code does not exist
*/
public static function forNumericCode(int $numericCode): array
{
diff --git a/src/Symfony/Component/Intl/Locales.php b/src/Symfony/Component/Intl/Locales.php
index aee16beb16..1b2d0d2adf 100644
--- a/src/Symfony/Component/Intl/Locales.php
+++ b/src/Symfony/Component/Intl/Locales.php
@@ -49,7 +49,7 @@ final class Locales extends ResourceBundle
}
/**
- * @throws MissingResourceException if the locale does not exists
+ * @throws MissingResourceException if the locale does not exist
*/
public static function getName(string $locale, string $displayLocale = null): string
{
diff --git a/src/Symfony/Component/Intl/Scripts.php b/src/Symfony/Component/Intl/Scripts.php
index 943ef8b469..bb29f0095b 100644
--- a/src/Symfony/Component/Intl/Scripts.php
+++ b/src/Symfony/Component/Intl/Scripts.php
@@ -41,7 +41,7 @@ final class Scripts extends ResourceBundle
}
/**
- * @throws MissingResourceException if the script code does not exists
+ * @throws MissingResourceException if the script code does not exist
*/
public static function getName(string $script, string $displayLocale = null): string
{
diff --git a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpTransportFactoryTest.php b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpTransportFactoryTest.php
index 60d5e806e3..b3cb7a6dc8 100644
--- a/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpTransportFactoryTest.php
+++ b/src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpTransportFactoryTest.php
@@ -28,6 +28,9 @@ class AmqpTransportFactoryTest extends TestCase
$this->assertFalse($factory->supports('invalid-dsn', []));
}
+ /**
+ * @requires extension amqp
+ */
public function testItCreatesTheTransport()
{
$factory = new AmqpTransportFactory();
diff --git a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
index 8e37e3873f..6d4db85b0b 100644
--- a/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
+++ b/src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Messenger\Transport\AmqpExt;
use Symfony\Component\Messenger\Exception\InvalidArgumentException;
+use Symfony\Component\Messenger\Exception\LogicException;
/**
* An AMQP connection.
@@ -58,6 +59,10 @@ class Connection
public function __construct(array $connectionOptions, array $exchangeOptions, array $queuesOptions, AmqpFactory $amqpFactory = null)
{
+ if (!\extension_loaded('amqp')) {
+ throw new LogicException(sprintf('You cannot use the "%s" as the "amqp" extension is not installed.', __CLASS__));
+ }
+
$this->connectionOptions = array_replace_recursive([
'delay' => [
'exchange_name' => 'delays',
diff --git a/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php b/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php
index 4541a1095d..50e95ef5e2 100644
--- a/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php
+++ b/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Messenger\Transport\Doctrine;
use Doctrine\Common\Persistence\ConnectionRegistry;
+use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Component\Messenger\Exception\TransportException;
use Symfony\Component\Messenger\Transport\Serialization\SerializerInterface;
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
@@ -24,8 +25,12 @@ class DoctrineTransportFactory implements TransportFactoryInterface
{
private $registry;
- public function __construct(ConnectionRegistry $registry)
+ public function __construct($registry)
{
+ if (!$registry instanceof RegistryInterface && !$registry instanceof ConnectionRegistry) {
+ throw new \TypeError(sprintf('Expected an instance of %s or %s, but got %s.', RegistryInterface::class, ConnectionRegistry::class, \is_object($registry) ? \get_class($registry) : \gettype($registry)));
+ }
+
$this->registry = $registry;
}
diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
index 4d546285f5..2385957d93 100644
--- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
@@ -148,7 +148,6 @@ class SwitchUserListener implements ListenerInterface
try {
$this->provider->loadUserByUsername($nonExistentUsername);
- throw new \LogicException('AuthenticationException expected');
} catch (AuthenticationException $e) {
}
} catch (AuthenticationException $e) {
diff --git a/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
index 15b535b0c7..b32a04b5a9 100644
--- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
+++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
@@ -27,7 +27,7 @@ trait ClassResolverTrait
*
* @param object|string $value
*
- * @throws InvalidArgumentException If the class does not exists
+ * @throws InvalidArgumentException If the class does not exist
*/
private function getClass($value): string
{
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
index 5a391a2e66..21e2392c7d 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
@@ -362,6 +362,10 @@
このパスワードは漏洩している為使用できません。
+
+
+ {{ min }}以上{{ max }}以下でなければなりません。
+