From 8a68d2d358ae7db406f72711c24d5c8f687cf7b6 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Wed, 13 Nov 2019 09:48:47 +0100
Subject: [PATCH 01/41] bumped Symfony version to 3.4.36
---
src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 05b11f3665c5c..25236948695dc 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -67,12 +67,12 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
private $requestStackSize = 0;
private $resetServices = false;
- const VERSION = '3.4.35';
- const VERSION_ID = 30435;
+ const VERSION = '3.4.36-DEV';
+ const VERSION_ID = 30436;
const MAJOR_VERSION = 3;
const MINOR_VERSION = 4;
- const RELEASE_VERSION = 35;
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = 36;
+ const EXTRA_VERSION = 'DEV';
const END_OF_MAINTENANCE = '11/2020';
const END_OF_LIFE = '11/2021';
From 78dad79fec4a55893cd04e8255c9a66cf34f5be1 Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Thu, 14 Nov 2019 16:04:06 +0100
Subject: [PATCH 02/41] [WebProfilerBundle] Require symfony/twig-bundle
---
src/Symfony/Bundle/WebProfilerBundle/composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Bundle/WebProfilerBundle/composer.json b/src/Symfony/Bundle/WebProfilerBundle/composer.json
index 241a5e350b414..c82ef0fe0093d 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/composer.json
+++ b/src/Symfony/Bundle/WebProfilerBundle/composer.json
@@ -20,7 +20,7 @@
"symfony/http-kernel": "~3.4.25|^4.2.6",
"symfony/polyfill-php70": "~1.0",
"symfony/routing": "~2.8|~3.0|~4.0",
- "symfony/twig-bridge": "~2.8|~3.0|~4.0",
+ "symfony/twig-bundle": "~2.8|~3.0|~4.0",
"symfony/var-dumper": "~3.3|~4.0",
"twig/twig": "~1.34|~2.4"
},
From e6c9d77b63ba7449b3b386b54f60ed18e0db3872 Mon Sep 17 00:00:00 2001
From: Damien Alexandre
Date: Fri, 15 Nov 2019 15:28:29 +0100
Subject: [PATCH 03/41] [Finder] Allow ssh2 stream wrapper for sftp
Same fix as #28604 but for the ss2.sftp wrapper.
---
src/Symfony/Component/Finder/Finder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php
index 6624e840791fb..c8f642d872ce3 100644
--- a/src/Symfony/Component/Finder/Finder.php
+++ b/src/Symfony/Component/Finder/Finder.php
@@ -746,7 +746,7 @@ private function normalizeDir($dir)
{
$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
- if (preg_match('#^s?ftp://#', $dir)) {
+ if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
$dir .= '/';
}
From 7e38d83ad00399a93ea267a48d9727e377c3e117 Mon Sep 17 00:00:00 2001
From: Antoine Makdessi
Date: Fri, 15 Nov 2019 19:14:27 +0100
Subject: [PATCH 04/41] Link the right file depending on the new version
---
UPGRADE-4.0.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/UPGRADE-4.0.md b/UPGRADE-4.0.md
index 8d41f32658c58..f970041949e5b 100644
--- a/UPGRADE-4.0.md
+++ b/UPGRADE-4.0.md
@@ -26,8 +26,8 @@ file and directory structure of your application:
Then, upgrade the contents of your console script and your front controller:
-* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/3.3/bin/console
-* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/public/index.php
+* `bin/console`: https://github.com/symfony/recipes/blob/master/symfony/console/4.4/bin/console
+* `public/index.php`: https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/4.4/public/index.php
Lastly, read the following article to add Symfony Flex to your application and
upgrade the configuration files: https://symfony.com/doc/current/setup/flex.html
From 51c5f69274b0a0375b049fc34a4336ec80b49b60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Broutier?=
Date: Sat, 16 Nov 2019 12:20:14 +0100
Subject: [PATCH 05/41] Fix MySQL column type definition.
Fix wrong MySQL column type definition causing Numeric value out of range exception.
Ref #34409
---
.../Session/Storage/Handler/PdoSessionHandler.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
index f9e5d1e8f04d8..c9d47b6ed7c27 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -218,7 +218,7 @@ public function createTable()
// - trailing space removal
// - case-insensitivity
// - language processing like é == e
- $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol MEDIUMINT NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
+ $sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
break;
case 'sqlite':
$sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
From eaca085aa4ec40b51f0591de411f840481319972 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Sat, 16 Nov 2019 16:50:12 +0100
Subject: [PATCH 06/41] [SecurityBundle] fix failing test
---
.../SecurityBundle/Tests/Functional/SwitchUserTest.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
index 31f99da2a08f2..722bef0f78628 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/SwitchUserTest.php
@@ -25,6 +25,10 @@ public function testSwitchUser($originalUser, $targetUser, $expectedUser, $expec
$client->request('GET', '/profile?_switch_user='.$targetUser);
+ if ('user_does_not_exist' === $targetUser && 403 === $expectedStatus && 500 === $client->getResponse()->getStatusCode()) {
+ $expectedStatus = 500; // 403 is generated by Symfony >= 4.3.8
+ }
+
$this->assertEquals($expectedStatus, $client->getResponse()->getStatusCode());
$this->assertEquals($expectedUser, $client->getProfile()->getCollector('security')->getUser());
}
@@ -68,7 +72,7 @@ public function getTestParameters()
return [
'unauthorized_user_cannot_switch' => ['user_cannot_switch_1', 'user_cannot_switch_1', 'user_cannot_switch_1', 403],
'authorized_user_can_switch' => ['user_can_switch', 'user_cannot_switch_1', 'user_cannot_switch_1', 200],
- 'authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', 'user_does_not_exist', 'user_can_switch', 500],
+ 'authorized_user_cannot_switch_to_non_existent' => ['user_can_switch', 'user_does_not_exist', 'user_can_switch', 403],
'authorized_user_can_switch_to_himself' => ['user_can_switch', 'user_can_switch', 'user_can_switch', 200],
];
}
From bd0637ebe4e8779b6b7b5b447ca4fd3d5ff44149 Mon Sep 17 00:00:00 2001
From: Mark Beech
Date: Wed, 13 Nov 2019 20:07:22 +0000
Subject: [PATCH 07/41] [HttpFoundation] Allow redirecting to URLs that contain
a semicolon
---
src/Symfony/Component/HttpFoundation/RedirectResponse.php | 2 +-
.../Component/HttpFoundation/Tests/RedirectResponseTest.php | 5 +----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/src/Symfony/Component/HttpFoundation/RedirectResponse.php
index 4e3cb4f77b28b..a19efba3e3d5e 100644
--- a/src/Symfony/Component/HttpFoundation/RedirectResponse.php
+++ b/src/Symfony/Component/HttpFoundation/RedirectResponse.php
@@ -93,7 +93,7 @@ public function setTargetUrl($url)
-
+
Codestin Search App
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
index e1ff3bf2bdb98..2bbf5aa1aea5a 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php
@@ -20,10 +20,7 @@ public function testGenerateMetaRedirect()
{
$response = new RedirectResponse('foo.bar');
- $this->assertEquals(1, preg_match(
- '##',
- preg_replace(['/\s+/', '/\'/'], [' ', '"'], $response->getContent())
- ));
+ $this->assertRegExp('##', preg_replace('/\s+/', ' ', $response->getContent()));
}
public function testRedirectResponseConstructorNullUrl()
From d53b91a45af4f83c83e1ed896b5954bc2aa83e75 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Wed, 10 Jul 2019 01:47:30 +0200
Subject: [PATCH 08/41] Add conflict rule for Monolog 2.
---
composer.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/composer.json b/composer.json
index 42397d75b851d..9ad5e39ad2ca5 100644
--- a/composer.json
+++ b/composer.json
@@ -103,6 +103,7 @@
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
},
"conflict": {
+ "monolog/monolog": ">=2",
"phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2",
"phpdocumentor/type-resolver": "<0.3.0",
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
From 7b7f9667119a7de82cc9d2c8a828d4d479929697 Mon Sep 17 00:00:00 2001
From: Nardberjean
Date: Sun, 17 Nov 2019 11:11:27 -0500
Subject: [PATCH 09/41] Update HttpKernel.php
---
src/Symfony/Component/HttpKernel/HttpKernel.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpKernel/HttpKernel.php b/src/Symfony/Component/HttpKernel/HttpKernel.php
index bca2cd1688e8e..9769d5e802b2d 100644
--- a/src/Symfony/Component/HttpKernel/HttpKernel.php
+++ b/src/Symfony/Component/HttpKernel/HttpKernel.php
@@ -62,7 +62,7 @@ public function __construct(EventDispatcherInterface $dispatcher, ControllerReso
*/
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
- $request->headers->set('X-Php-Ob-Level', ob_get_level());
+ $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
From c194fffaef3d5df57186117c96f8e99aed82fbbe Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Sun, 17 Nov 2019 22:18:02 +0100
Subject: [PATCH 10/41] Adjust pull request template for 5.0 branchout
---
.github/PULL_REQUEST_TEMPLATE.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index b863dea0cbf9a..4d7b45b66b560 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,6 +1,6 @@
| Q | A
| ------------- | ---
-| Branch? | 4.4 for features / 3.4 or 4.3 for bug fixes
+| Branch? | master for features / 3.4, 4.3, 4.4 or 5.0 for bug fixes
| Bug fix? | yes/no
| New feature? | yes/no
| Deprecations? | yes/no
From 934e05c00b89cba6171eeeb19f93e68f43f8352a Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Sun, 17 Nov 2019 22:52:25 +0100
Subject: [PATCH 11/41] Fix PR template
---
.github/PULL_REQUEST_TEMPLATE.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 4d7b45b66b560..0d234d8fe9b7f 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -16,6 +16,5 @@ Additionally (see https://symfony.com/roadmap):
- Never break backward compatibility (see https://symfony.com/bc).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- - Features and deprecations must be submitted against branch 4.4.
- - Legacy code removals go to the master branch.
+ - Features and deprecations must be submitted against branch master.
-->
From e7d0787a4dfe68c33c81f09aa8fb59fe67ea90dc Mon Sep 17 00:00:00 2001
From: Markus Staab
Date: Sun, 17 Nov 2019 16:24:49 +0100
Subject: [PATCH 12/41] [Finder] Fixed docs
---
src/Symfony/Component/Finder/Finder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php
index c8f642d872ce3..d2ea17d87a00f 100644
--- a/src/Symfony/Component/Finder/Finder.php
+++ b/src/Symfony/Component/Finder/Finder.php
@@ -736,7 +736,7 @@ private function searchInDirectory($dir)
/**
* Normalizes given directory names by removing trailing slashes.
*
- * Excluding: (s)ftp:// wrapper
+ * Excluding: (s)ftp:// or ssh2.(s)ftp:// wrapper
*
* @param string $dir
*
From 8d1f32613ba1296f0766f34166e399a442d76912 Mon Sep 17 00:00:00 2001
From: Maxime Steinhausser
Date: Tue, 19 Nov 2019 17:14:53 +0100
Subject: [PATCH 13/41] [Validator] ConstraintValidatorTestCase: add missing
return value to mocked validate method calls
---
.../Validator/Test/ConstraintValidatorTestCase.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
index 18705b7987efe..ed57d396ae00e 100644
--- a/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
+++ b/src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php
@@ -177,7 +177,8 @@ protected function expectValidateAt($i, $propertyPath, $value, $group)
->willReturn($validator);
$validator->expects($this->at(2 * $i + 1))
->method('validate')
- ->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group);
+ ->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group)
+ ->willReturn($validator);
}
protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null)
@@ -189,7 +190,8 @@ protected function expectValidateValueAt($i, $propertyPath, $value, $constraints
->willReturn($contextualValidator);
$contextualValidator->expects($this->at(2 * $i + 1))
->method('validate')
- ->with($value, $constraints, $group);
+ ->with($value, $constraints, $group)
+ ->willReturn($contextualValidator);
}
protected function assertNoViolation()
From 960faef66f48d71d04d605c9067d05ba95dc7585 Mon Sep 17 00:00:00 2001
From: Matthias Pigulla
Date: Thu, 14 Nov 2019 23:18:30 +0100
Subject: [PATCH 14/41] Avoid empty \"If-Modified-Since\" header in validation
request
---
src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php | 4 +++-
.../Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
index addeca8bae143..dbe028065948d 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
@@ -352,7 +352,9 @@ protected function validate(Request $request, Response $entry, $catch = false)
}
// 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 a50e09fb14f93..93d92eb11e7e3 100644
--- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php
@@ -859,6 +859,7 @@ public function testValidatesCachedResponsesUseSameHttpMethod()
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')) {
From 026730e913ef09522a2e57a07147e3d740f13e7a Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Sat, 23 Nov 2019 21:28:49 +0100
Subject: [PATCH 15/41] Remove some unused methods parameters
---
.../Console/Descriptor/JsonDescriptor.php | 4 ++--
.../DependencyInjection/SecurityExtension.php | 4 ++--
.../Bundle/WebServerBundle/Command/ServerLogCommand.php | 4 ++--
.../DependencyInjection/Loader/XmlFileLoader.php | 9 ++++-----
.../Component/Translation/Dumper/XliffFileDumper.php | 4 ++--
5 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
index ea5d0c7d0bffa..197db657f0015 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php
@@ -166,7 +166,7 @@ protected function describeEventDispatcherListeners(EventDispatcherInterface $ev
*/
protected function describeCallable($callable, array $options = [])
{
- $this->writeData($this->getCallableData($callable, $options), $options);
+ $this->writeData($this->getCallableData($callable), $options);
}
/**
@@ -321,7 +321,7 @@ private function getEventDispatcherListenersData(EventDispatcherInterface $event
*
* @return array
*/
- private function getCallableData($callable, array $options = [])
+ private function getCallableData($callable)
{
$data = [];
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index 731ce42d39328..795fe053e66e4 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -585,7 +585,7 @@ private function createEncoders($encoders, ContainerBuilder $container)
{
$encoderMap = [];
foreach ($encoders as $class => $encoder) {
- $encoderMap[$class] = $this->createEncoder($encoder, $container);
+ $encoderMap[$class] = $this->createEncoder($encoder);
}
$container
@@ -594,7 +594,7 @@ private function createEncoders($encoders, ContainerBuilder $container)
;
}
- private function createEncoder($config, ContainerBuilder $container)
+ private function createEncoder($config)
{
// a custom encoder service
if (isset($config['id'])) {
diff --git a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
index 73c51cc8e09e4..5c9ce910ddf54 100644
--- a/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
+++ b/src/Symfony/Bundle/WebServerBundle/Command/ServerLogCommand.php
@@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
continue;
}
- $this->displayLog($input, $output, $clientId, $record);
+ $this->displayLog($output, $clientId, $record);
}
}
@@ -141,7 +141,7 @@ private function getLogs($socket)
}
}
- private function displayLog(InputInterface $input, OutputInterface $output, $clientId, array $record)
+ private function displayLog(OutputInterface $output, $clientId, array $record)
{
if ($this->handler->isHandling($record)) {
if (isset($record['log_id'])) {
diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
index c4b9b69a03ca2..bd2902f85681a 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
@@ -278,7 +278,7 @@ private function parseDefinition(\DOMElement $service, $file, array $defaults)
$definition->setDeprecated(true, $deprecated[0]->nodeValue ?: null);
}
- $definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, false, $definition instanceof ChildDefinition));
+ $definition->setArguments($this->getArgumentsAsPhp($service, 'argument', $file, $definition instanceof ChildDefinition));
$definition->setProperties($this->getArgumentsAsPhp($service, 'property', $file));
if ($factories = $this->getChildren($service, 'factory')) {
@@ -452,11 +452,10 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults)
*
* @param string $name
* @param string $file
- * @param bool $lowercase
*
* @return mixed
*/
- private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = true, $isChildDefinition = false)
+ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $isChildDefinition = false)
{
$arguments = [];
foreach ($this->getChildren($node, $name) as $arg) {
@@ -506,10 +505,10 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
$arguments[$key] = new Expression($arg->nodeValue);
break;
case 'collection':
- $arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file, false);
+ $arguments[$key] = $this->getArgumentsAsPhp($arg, $name, $file);
break;
case 'iterator':
- $arg = $this->getArgumentsAsPhp($arg, $name, $file, false);
+ $arg = $this->getArgumentsAsPhp($arg, $name, $file);
try {
$arguments[$key] = new IteratorArgument($arg);
} catch (InvalidArgumentException $e) {
diff --git a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
index cd867b0967908..f933be8b258df 100644
--- a/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
+++ b/src/Symfony/Component/Translation/Dumper/XliffFileDumper.php
@@ -41,7 +41,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti
return $this->dumpXliff1($defaultLocale, $messages, $domain, $options);
}
if ('2.0' === $xliffVersion) {
- return $this->dumpXliff2($defaultLocale, $messages, $domain, $options);
+ return $this->dumpXliff2($defaultLocale, $messages, $domain);
}
throw new InvalidArgumentException(sprintf('No support implemented for dumping XLIFF version "%s".', $xliffVersion));
@@ -129,7 +129,7 @@ private function dumpXliff1($defaultLocale, MessageCatalogue $messages, $domain,
return $dom->saveXML();
}
- private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, array $options = [])
+ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain)
{
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->formatOutput = true;
From 6cea35a10870de486c2001e3e2a0b0b3a96309ea Mon Sep 17 00:00:00 2001
From: "Issei.M"
Date: Sun, 24 Nov 2019 16:00:50 +0900
Subject: [PATCH 16/41] [Validator] Add Japanese translation
---
.../Validator/Resources/translations/validators.ja.xlf | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf
index 5a391a2e6626e..21e2392c7d96c 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 @@
This password has been leaked in a data breach, it must not be used. Please use another password.
このパスワードは漏洩している為使用できません。
+
+ This value should be between {{ min }} and {{ max }}.
+ {{ min }}以上{{ max }}以下でなければなりません。
+
From 465f092aeba45eb0c35882f566dc6e3c73d03b7a Mon Sep 17 00:00:00 2001
From: Antoine Makdessi
Date: Tue, 19 Nov 2019 22:39:45 +0100
Subject: [PATCH 17/41] Improve Symfony description
According to https://symfony.com/stats/downloads :)
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 5796b1acd7ceb..da9e6156c00d7 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-[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).
From aa045d10b91f8290f553438900d9a732bec5d6ec Mon Sep 17 00:00:00 2001
From: Sander Toonen
Date: Fri, 22 Nov 2019 22:50:07 +0100
Subject: [PATCH 18/41] [Monolog Bridge] Fixed accessing static property as non
static.
---
src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
index c27b0803e200e..c8e21b2f42622 100644
--- a/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/ChromePhpHandler.php
@@ -39,7 +39,7 @@ public function onKernelResponse(FilterResponseEvent $event)
}
if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
- $this->sendHeaders = false;
+ self::$sendHeaders = false;
$this->headers = [];
return;
@@ -57,7 +57,7 @@ public function onKernelResponse(FilterResponseEvent $event)
*/
protected function sendHeader($header, $content)
{
- if (!$this->sendHeaders) {
+ if (!self::$sendHeaders) {
return;
}
From 7524ac2866fee55fe563b3252450dede03d9f468 Mon Sep 17 00:00:00 2001
From: Hugo Hamon
Date: Mon, 25 Nov 2019 17:36:22 +0100
Subject: [PATCH 19/41] [Filesystem] [Serializer] fixes English grammar typo
---
src/Symfony/Component/Filesystem/Tests/FilesystemTest.php | 2 +-
.../Component/Serializer/Mapping/Factory/ClassResolverTrait.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index a5b7f6dceb51f..e9e7784a3af40 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -801,7 +801,7 @@ public function testSymlink()
$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/Serializer/Mapping/Factory/ClassResolverTrait.php b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
index 73c02a647c57e..5c58476383427 100644
--- a/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
+++ b/src/Symfony/Component/Serializer/Mapping/Factory/ClassResolverTrait.php
@@ -29,7 +29,7 @@ trait ClassResolverTrait
*
* @return string
*
- * @throws InvalidArgumentException If the class does not exists
+ * @throws InvalidArgumentException If the class does not exist
*/
private function getClass($value)
{
From 685c36c3d2695a7e4fe589675f0a79d4d7fe65bd Mon Sep 17 00:00:00 2001
From: Emanuele Panzeri
Date: Wed, 27 Nov 2019 17:54:05 +0100
Subject: [PATCH 20/41] [Cache] Make sure we get the correct number of values
from redis::mget()
---
src/Symfony/Component/Cache/Traits/RedisTrait.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Cache/Traits/RedisTrait.php b/src/Symfony/Component/Cache/Traits/RedisTrait.php
index 395a9b8051b4f..c4b12b64bb37b 100644
--- a/src/Symfony/Component/Cache/Traits/RedisTrait.php
+++ b/src/Symfony/Component/Cache/Traits/RedisTrait.php
@@ -179,7 +179,13 @@ protected function doFetch(array $ids)
}
});
} else {
- $values = array_combine($ids, $this->redis->mget($ids));
+ $values = $this->redis->mget($ids);
+
+ if (!\is_array($values) || \count($values) !== \count($ids)) {
+ return [];
+ }
+
+ $values = array_combine($ids, $values);
}
foreach ($values as $id => $v) {
From 2b62dc3fc54febbe0b98ef899089f1de5f297622 Mon Sep 17 00:00:00 2001
From: Ahmed
Date: Mon, 25 Nov 2019 19:09:41 +0100
Subject: [PATCH 21/41] [Process] add tests for php executable finder if file
does not exist
---
.../Process/Tests/PhpExecutableFinderTest.php | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
index 795be8fa24bfc..c6804765f7694 100644
--- a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
+++ b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
@@ -69,4 +69,16 @@ public function testFindArguments()
$this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments');
}
}
+
+ public function testNotExitsBinaryFile()
+ {
+ $f = new PhpExecutableFinder();
+ $phpBinaryEnv = PHP_BINARY;
+ putenv('PHP_BINARY=/usr/local/php/bin/php-invalid');
+
+ $this->assertFalse($f->find(), '::find() returns false because of not exist file');
+ $this->assertFalse($f->find(false), '::find(false) returns false because of not exist file');
+
+ putenv('PHP_BINARY='.$phpBinaryEnv);
+ }
}
From c6ed0f020880595dee3282c9088ba2f0f065bd74 Mon Sep 17 00:00:00 2001
From: David Buchmann
Date: Wed, 27 Nov 2019 10:48:32 +0100
Subject: [PATCH 22/41] more robust initialization from request
Request::getPort is declared as int|string but can actually return null.
---
src/Symfony/Component/Routing/RequestContext.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Routing/RequestContext.php b/src/Symfony/Component/Routing/RequestContext.php
index 8ebad8e2538db..ed50cd70d835a 100644
--- a/src/Symfony/Component/Routing/RequestContext.php
+++ b/src/Symfony/Component/Routing/RequestContext.php
@@ -67,8 +67,8 @@ public function fromRequest(Request $request)
$this->setMethod($request->getMethod());
$this->setHost($request->getHost());
$this->setScheme($request->getScheme());
- $this->setHttpPort($request->isSecure() ? $this->httpPort : $request->getPort());
- $this->setHttpsPort($request->isSecure() ? $request->getPort() : $this->httpsPort);
+ $this->setHttpPort($request->isSecure() || null === $request->getPort() ? $this->httpPort : $request->getPort());
+ $this->setHttpsPort($request->isSecure() && null !== $request->getPort() ? $request->getPort() : $this->httpsPort);
$this->setQueryString($request->server->get('QUERY_STRING', ''));
return $this;
From 069d214210e579682849657e37377405d0c2ebfc Mon Sep 17 00:00:00 2001
From: Ali Tavafi
Date: Tue, 26 Nov 2019 17:54:05 +0330
Subject: [PATCH 23/41] [Console] Fix trying to access array offset on value of
type int
---
src/Symfony/Component/Console/Input/ArrayInput.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/Console/Input/ArrayInput.php b/src/Symfony/Component/Console/Input/ArrayInput.php
index a04b6b68ea0c8..b2ebc7c2258e2 100644
--- a/src/Symfony/Component/Console/Input/ArrayInput.php
+++ b/src/Symfony/Component/Console/Input/ArrayInput.php
@@ -39,8 +39,8 @@ public function __construct(array $parameters, InputDefinition $definition = nul
*/
public function getFirstArgument()
{
- foreach ($this->parameters as $key => $value) {
- if ($key && '-' === $key[0]) {
+ foreach ($this->parameters as $param => $value) {
+ if ($param && \is_string($param) && '-' === $param[0]) {
continue;
}
@@ -107,7 +107,7 @@ public function __toString()
{
$params = [];
foreach ($this->parameters as $param => $val) {
- if ($param && '-' === $param[0]) {
+ if ($param && \is_string($param) && '-' === $param[0]) {
if (\is_array($val)) {
foreach ($val as $v) {
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
From 388528da502368054c362487ab36ec7b27d1c6fd Mon Sep 17 00:00:00 2001
From: Roy-Orbison
Date: Wed, 20 Nov 2019 15:04:29 +1030
Subject: [PATCH 24/41] Simpler example for Apache basic auth workaround
Uses a simpler regex and existing back-reference instead of reading header twice.
---
src/Symfony/Component/HttpFoundation/ServerBag.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/ServerBag.php b/src/Symfony/Component/HttpFoundation/ServerBag.php
index 4c82b1774873f..f3b64023489ef 100644
--- a/src/Symfony/Component/HttpFoundation/ServerBag.php
+++ b/src/Symfony/Component/HttpFoundation/ServerBag.php
@@ -46,13 +46,13 @@ public function getHeaders()
/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
* For this workaround to work, add these lines to your .htaccess file:
- * RewriteCond %{HTTP:Authorization} ^(.+)$
- * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+ * RewriteCond %{HTTP:Authorization} .+
+ * RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
*
* A sample .htaccess file:
* RewriteEngine On
- * RewriteCond %{HTTP:Authorization} ^(.+)$
- * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+ * RewriteCond %{HTTP:Authorization} .+
+ * RewriteRule ^ - [E=HTTP_AUTHORIZATION:%0]
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteRule ^(.*)$ app.php [QSA,L]
*/
From 53241df2dfbf524544a42ee6810caba91f8bd29f Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 28 Nov 2019 11:05:51 +0100
Subject: [PATCH 25/41] Revert "minor #34608 [Process] add tests for php
executable finder if file does not exist (ahmedash95)"
This reverts commit 5cacc5dd691d92926855ae7b62bb664fbc811539, reversing
changes made to f0a6de27366741cc2ae16589ad1bd2965d797f63.
---
.../Process/Tests/PhpExecutableFinderTest.php | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
index c6804765f7694..795be8fa24bfc 100644
--- a/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
+++ b/src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
@@ -69,16 +69,4 @@ public function testFindArguments()
$this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments');
}
}
-
- public function testNotExitsBinaryFile()
- {
- $f = new PhpExecutableFinder();
- $phpBinaryEnv = PHP_BINARY;
- putenv('PHP_BINARY=/usr/local/php/bin/php-invalid');
-
- $this->assertFalse($f->find(), '::find() returns false because of not exist file');
- $this->assertFalse($f->find(false), '::find(false) returns false because of not exist file');
-
- putenv('PHP_BINARY='.$phpBinaryEnv);
- }
}
From b9d5237f675d57c53ae559374416104669fdc990 Mon Sep 17 00:00:00 2001
From: Maxime Helias
Date: Thu, 28 Nov 2019 11:09:39 +0100
Subject: [PATCH 26/41] [DI] Missing test on YamlFileLoader
---
.../Tests/Loader/YamlFileLoaderTest.php | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index 1d187848b3b39..cce3921853e5d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -349,6 +349,9 @@ public function testParsesIteratorArgument()
$lazyDefinition = $container->getDefinition('lazy_context');
$this->assertEquals([new IteratorArgument(['k1' => new Reference('foo.baz'), 'k2' => new Reference('service_container')]), new IteratorArgument([])], $lazyDefinition->getArguments(), '->load() parses lazy arguments');
+
+ $message = 'The "deprecated_service" service is deprecated. You should stop using it, as it will soon be removed.';
+ $this->assertSame($message, $container->getDefinition('deprecated_service')->getDeprecationMessage('deprecated_service'));
}
public function testAutowire()
@@ -717,4 +720,17 @@ public function testOverriddenDefaultsBindings()
$this->assertSame('overridden', $container->get('bar')->quz);
}
+
+ /**
+ * @group legacy
+ * @expectedDeprecation The configuration key "factory" is unsupported for the service "foo" which is defined as an alias in %s.
+ * @expectedDeprecation The configuration key "parent" is unsupported for the service "foo" which is defined as an alias in %s.
+ */
+ public function testAliasDefinitionContainsUnsupportedElements()
+ {
+ $container = new ContainerBuilder();
+ $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
+ $loader->load('legacy_invalid_alias_definition.yml');
+ $this->assertTrue($container->has('foo'));
+ }
}
From 3378890e704ed397f2b30ad9677c689cf7a6352c Mon Sep 17 00:00:00 2001
From: Thomas Bisignani
Date: Thu, 28 Nov 2019 13:52:59 +0100
Subject: [PATCH 27/41] [HttpFoundation] Fixed typo
---
src/Symfony/Component/HttpFoundation/BinaryFileResponse.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
index f43114111b076..ea7ac846974bd 100644
--- a/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
+++ b/src/Symfony/Component/HttpFoundation/BinaryFileResponse.php
@@ -348,7 +348,7 @@ public static function trustXSendfileTypeHeader()
}
/**
- * If this is set to true, the file will be unlinked after the request is send
+ * If this is set to true, the file will be unlinked after the request is sent
* Note: If the X-Sendfile header is used, the deleteFileAfterSend setting will not be used.
*
* @param bool $shouldDelete
From 4d4786812581115ae63d1f07f72ecc923b35a430 Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Sat, 26 Oct 2019 13:22:27 +0200
Subject: [PATCH 28/41] [Console] Fix commands description with numeric
namespaces
---
.../Descriptor/ApplicationDescription.php | 24 +++++----
.../Descriptor/ApplicationDescriptionTest.php | 53 +++++++++++++++++++
2 files changed, 68 insertions(+), 9 deletions(-)
create mode 100644 src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php
diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
index 442a569711c07..7e214712da6f3 100644
--- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
+++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php
@@ -129,23 +129,29 @@ private function sortCommands(array $commands)
{
$namespacedCommands = [];
$globalCommands = [];
+ $sortedCommands = [];
foreach ($commands as $name => $command) {
$key = $this->application->extractNamespace($name, 1);
- if (!$key) {
- $globalCommands['_global'][$name] = $command;
+ if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
+ $globalCommands[$name] = $command;
} else {
$namespacedCommands[$key][$name] = $command;
}
}
- ksort($namespacedCommands);
- $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
- foreach ($namespacedCommands as &$commandsSet) {
- ksort($commandsSet);
+ if ($globalCommands) {
+ ksort($globalCommands);
+ $sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
}
- // unset reference to keep scope clear
- unset($commandsSet);
- return $namespacedCommands;
+ if ($namespacedCommands) {
+ ksort($namespacedCommands);
+ foreach ($namespacedCommands as $key => $commandsSet) {
+ ksort($commandsSet);
+ $sortedCommands[$key] = $commandsSet;
+ }
+ }
+
+ return $sortedCommands;
}
}
diff --git a/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php b/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php
new file mode 100644
index 0000000000000..33d5c3840f3e3
--- /dev/null
+++ b/src/Symfony/Component/Console/Tests/Descriptor/ApplicationDescriptionTest.php
@@ -0,0 +1,53 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Console\Tests\Descriptor;
+
+use PHPUnit\Framework\TestCase;
+use Symfony\Component\Console\Application;
+use Symfony\Component\Console\Command\Command;
+use Symfony\Component\Console\Descriptor\ApplicationDescription;
+
+final class ApplicationDescriptionTest extends TestCase
+{
+ /**
+ * @dataProvider getNamespacesProvider
+ */
+ public function testGetNamespaces(array $expected, array $names)
+ {
+ $application = new TestApplication();
+ foreach ($names as $name) {
+ $application->add(new Command($name));
+ }
+
+ $this->assertSame($expected, array_keys((new ApplicationDescription($application))->getNamespaces()));
+ }
+
+ public function getNamespacesProvider()
+ {
+ return [
+ [['_global'], ['foobar']],
+ [['a', 'b'], ['b:foo', 'a:foo', 'b:bar']],
+ [['_global', 'b', 'z', 22, 33], ['z:foo', '1', '33:foo', 'b:foo', '22:foo:bar']],
+ ];
+ }
+}
+
+final class TestApplication extends Application
+{
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDefaultCommands()
+ {
+ return [];
+ }
+}
From fffeccd7445092bb7ec140adfb827fb677096aad Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 28 Nov 2019 16:39:39 +0100
Subject: [PATCH 29/41] [Config] don't break on virtual stack frames in
ClassExistenceResource
---
.../Config/Resource/ClassExistenceResource.php | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
index 1ba8e76248322..340e28f245a85 100644
--- a/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
+++ b/src/Symfony/Component/Config/Resource/ClassExistenceResource.php
@@ -191,15 +191,17 @@ public static function throwOnRequiredClass($class, \Exception $previous = null)
}
$props = [
- 'file' => $trace[$i]['file'],
- 'line' => $trace[$i]['line'],
+ 'file' => isset($trace[$i]['file']) ? $trace[$i]['file'] : null,
+ 'line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : null,
'trace' => \array_slice($trace, 1 + $i),
];
foreach ($props as $p => $v) {
- $r = new \ReflectionProperty('Exception', $p);
- $r->setAccessible(true);
- $r->setValue($e, $v);
+ if (null !== $v) {
+ $r = new \ReflectionProperty('Exception', $p);
+ $r->setAccessible(true);
+ $r->setValue($e, $v);
+ }
}
}
From a1129f938c63c2b91bf3da20cd41a662c241433c Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Sat, 23 Nov 2019 18:59:57 +0100
Subject: [PATCH 30/41] [Console] Fix autocomplete multibyte input support
---
.../Console/Helper/QuestionHelper.php | 6 +++---
.../Tests/Helper/QuestionHelperTest.php | 20 +++++++++++--------
2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/Symfony/Component/Console/Helper/QuestionHelper.php b/src/Symfony/Component/Console/Helper/QuestionHelper.php
index af4d0b9cca459..cccaeb0248884 100644
--- a/src/Symfony/Component/Console/Helper/QuestionHelper.php
+++ b/src/Symfony/Component/Console/Helper/QuestionHelper.php
@@ -264,7 +264,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
} elseif ("\177" === $c) { // Backspace Character
if (0 === $numMatches && 0 !== $i) {
--$i;
- $fullChoice = substr($fullChoice, 0, -1);
+ $fullChoice = self::substr($fullChoice, 0, -1);
// Move cursor backwards
$output->write("\033[1D");
}
@@ -278,7 +278,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
}
// Pop the last character off the end of our string
- $ret = substr($ret, 0, $i);
+ $ret = self::substr($ret, 0, $i);
} elseif ("\033" === $c) {
// Did we read an escape sequence?
$c .= fread($inputStream, 2);
@@ -304,7 +304,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
$remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
$output->write($remainingCharacters);
$fullChoice .= $remainingCharacters;
- $i = \strlen($fullChoice);
+ $i = self::strlen($fullChoice);
}
if ("\n" === $c) {
diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
index 02cc6ce7e0249..2e91d49feeca9 100644
--- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
@@ -175,19 +175,20 @@ public function testAskWithAutocomplete()
// Acm
// AcsTest
//
- //
- // Test
+ //
+ // Test
//
// S
// F00oo
- $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n");
+ // F⭐⭐
+ $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\nF⭐\t\177\177⭐\t\n");
$dialog = new QuestionHelper();
$helperSet = new HelperSet([new FormatterHelper()]);
$dialog->setHelperSet($helperSet);
$question = new Question('Please select a bundle', 'FrameworkBundle');
- $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle']);
+ $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle', 'F⭐Y']);
$this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals('AsseticBundleTest', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
@@ -197,6 +198,7 @@ public function testAskWithAutocomplete()
$this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals('AsseticBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
$this->assertEquals('FooBundle', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
+ $this->assertEquals('F⭐Y', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
}
public function testAskWithAutocompleteWithNonSequentialKeys()
@@ -680,12 +682,13 @@ public function testLegacyAskWithAutocomplete()
// Acm
// AcsTest
//
- //
- // Test
+ //
+ // Test
//
// S
// F00oo
- $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\n");
+ // F⭐⭐
+ $inputStream = $this->getInputStream("Acm\nAc\177\177s\tTest\n\n\033[A\033[A\033[A\n\033[A\033[A\033[A\033[A\033[A\033[A\033[A\tTest\n\033[B\nS\177\177\033[B\033[B\nF00\177\177oo\t\nF⭐\t⭐\t\n");
$dialog = new QuestionHelper();
$dialog->setInputStream($inputStream);
@@ -693,7 +696,7 @@ public function testLegacyAskWithAutocomplete()
$dialog->setHelperSet($helperSet);
$question = new Question('Please select a bundle', 'FrameworkBundle');
- $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle']);
+ $question->setAutocompleterValues(['AcmeDemoBundle', 'AsseticBundle', 'SecurityBundle', 'FooBundle', 'F⭐Y']);
$this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$this->assertEquals('AsseticBundleTest', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@@ -703,6 +706,7 @@ public function testLegacyAskWithAutocomplete()
$this->assertEquals('AcmeDemoBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$this->assertEquals('AsseticBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$this->assertEquals('FooBundle', $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
+ $this->assertEquals('F⭐Y', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
}
/**
From a1ce0ed08602917d76810dbc2471dc25e28bda48 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Fri, 29 Nov 2019 15:40:35 +0100
Subject: [PATCH 31/41] fix dumping number-like string parameters
---
.../DependencyInjection/Dumper/XmlDumper.php | 5 +++++
.../Tests/Fixtures/containers/container8.php | 11 +++++++++++
.../Tests/Fixtures/php/services8.php | 11 +++++++++++
.../Tests/Fixtures/xml/services8.xml | 11 +++++++++++
.../Tests/Fixtures/yaml/services8.yml | 11 +++++++++++
5 files changed, 49 insertions(+)
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
index cfc932843937f..eff421ec4e71f 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
@@ -304,6 +304,11 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent
if (\in_array($value, ['null', 'true', 'false'], true)) {
$element->setAttribute('type', 'string');
}
+
+ if (\is_string($value) && (is_numeric($value) || preg_match('/^0b[01]*$/', $value) || preg_match('/^0x[0-9a-f]++$/i', $value))) {
+ $element->setAttribute('type', 'string');
+ }
+
$text = $this->document->createTextNode(self::phpToXml($value));
$element->appendChild($text);
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php
index 5b3c01c23cd52..edcd045eaabbb 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php
@@ -9,6 +9,17 @@
'bar' => 'foo is %%foo bar',
'escape' => '@escapeme',
'values' => [true, false, null, 0, 1000.3, 'true', 'false', 'null'],
+ 'null string' => 'null',
+ 'string of digits' => '123',
+ 'string of digits prefixed with minus character' => '-123',
+ 'true string' => 'true',
+ 'false string' => 'false',
+ 'binary number string' => '0b0110',
+ 'numeric string' => '-1.2E2',
+ 'hexadecimal number string' => '0xFF',
+ 'float string' => '10100.1',
+ 'positive float string' => '+10100.1',
+ 'negative float string' => '-10100.1',
]));
return $container;
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
index ce4815ef81975..e7a0214a10f53 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php
@@ -151,6 +151,17 @@ protected function getDefaultParameters()
6 => 'false',
7 => 'null',
],
+ 'null string' => 'null',
+ 'string of digits' => '123',
+ 'string of digits prefixed with minus character' => '-123',
+ 'true string' => 'true',
+ 'false string' => 'false',
+ 'binary number string' => '0b0110',
+ 'numeric string' => '-1.2E2',
+ 'hexadecimal number string' => '0xFF',
+ 'float string' => '10100.1',
+ 'positive float string' => '+10100.1',
+ 'negative float string' => '-10100.1',
];
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
index d0f9015c5a547..4b07bbb7da50c 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml
@@ -18,6 +18,17 @@
false
null
+ null
+ 123
+ -123
+ true
+ false
+ 0b0110
+ -1.2E2
+ 0xFF
+ 10100.1
+ +10100.1
+ -10100.1
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
index 4e37bc9315c9b..002b1d4bcd3a8 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml
@@ -4,6 +4,17 @@ parameters:
bar: 'foo is %%foo bar'
escape: '@@escapeme'
values: [true, false, null, 0, 1000.3, 'true', 'false', 'null']
+ null string: 'null'
+ string of digits: '123'
+ string of digits prefixed with minus character: '-123'
+ true string: 'true'
+ false string: 'false'
+ binary number string: '0b0110'
+ numeric string: '-1.2E2'
+ hexadecimal number string: '0xFF'
+ float string: '10100.1'
+ positive float string: '+10100.1'
+ negative float string: '-10100.1'
services:
service_container:
From 8de2a226a8de220bacbe1981f972c560c37d4e29 Mon Sep 17 00:00:00 2001
From: Thomas Calvet
Date: Sat, 23 Nov 2019 20:59:48 +0100
Subject: [PATCH 32/41] [Config][ReflectionClassResource] Handle parameters
with undefined constant as their default values
---
.../Resource/ReflectionClassResource.php | 50 +++++++++++++++++--
.../Resource/ReflectionClassResourceTest.php | 18 +++++--
2 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
index d5e6b829cfeca..4c8f89cd3f204 100644
--- a/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
+++ b/src/Symfony/Component/Config/Resource/ReflectionClassResource.php
@@ -151,12 +151,56 @@ private function generateSignature(\ReflectionClass $class)
}
} else {
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
- yield preg_replace('/^ @@.*/m', '', $m);
-
$defaults = [];
+ $parametersWithUndefinedConstants = [];
foreach ($m->getParameters() as $p) {
- $defaults[$p->name] = $p->isDefaultValueAvailable() ? $p->getDefaultValue() : null;
+ if (!$p->isDefaultValueAvailable()) {
+ $defaults[$p->name] = null;
+
+ continue;
+ }
+
+ if (!$p->isDefaultValueConstant() || \defined($p->getDefaultValueConstantName())) {
+ $defaults[$p->name] = $p->getDefaultValue();
+
+ continue;
+ }
+
+ $defaults[$p->name] = $p->getDefaultValueConstantName();
+ $parametersWithUndefinedConstants[$p->name] = true;
+ }
+
+ if (!$parametersWithUndefinedConstants) {
+ yield preg_replace('/^ @@.*/m', '', $m);
+ } else {
+ $stack = [
+ $m->getDocComment(),
+ $m->getName(),
+ $m->isAbstract(),
+ $m->isFinal(),
+ $m->isStatic(),
+ $m->isPublic(),
+ $m->isPrivate(),
+ $m->isProtected(),
+ $m->returnsReference(),
+ \PHP_VERSION_ID >= 70000 && $m->hasReturnType() ? (\PHP_VERSION_ID >= 70100 ? $m->getReturnType()->getName() : (string) $m->getReturnType()) : '',
+ ];
+
+ foreach ($m->getParameters() as $p) {
+ if (!isset($parametersWithUndefinedConstants[$p->name])) {
+ $stack[] = (string) $p;
+ } else {
+ $stack[] = $p->isOptional();
+ $stack[] = \PHP_VERSION_ID >= 70000 && $p->hasType() ? (\PHP_VERSION_ID >= 70100 ? $p->getType()->getName() : (string) $p->getType()) : '';
+ $stack[] = $p->isPassedByReference();
+ $stack[] = \PHP_VERSION_ID >= 50600 ? $p->isVariadic() : '';
+ $stack[] = $p->getName();
+ }
+ }
+
+ yield implode(',', $stack);
}
+
yield print_r($defaults, true);
}
}
diff --git a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
index 76cad1433bb20..74ed6b3edc2a9 100644
--- a/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
+++ b/src/Symfony/Component/Config/Tests/Resource/ReflectionClassResourceTest.php
@@ -63,8 +63,12 @@ public function testIsFreshForDeletedResources()
/**
* @dataProvider provideHashedSignature
*/
- public function testHashedSignature($changeExpected, $changedLine, $changedCode)
+ public function testHashedSignature($changeExpected, $changedLine, $changedCode, $setContext = null)
{
+ if ($setContext) {
+ $setContext();
+ }
+
$code = <<<'EOPHP'
/* 0*/
/* 1*/ class %s extends ErrorException
@@ -82,7 +86,9 @@ public function testHashedSignature($changeExpected, $changedLine, $changedCode)
/*13*/ protected function prot($a = []) {}
/*14*/
/*15*/ private function priv() {}
-/*16*/ }
+/*16*/
+/*17*/ public function ccc($bar = A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC) {}
+/*18*/ }
EOPHP;
static $expectedSignature, $generateSignature;
@@ -97,7 +103,9 @@ public function testHashedSignature($changeExpected, $changedLine, $changedCode)
}
$code = explode("\n", $code);
- $code[$changedLine] = $changedCode;
+ if (null !== $changedCode) {
+ $code[$changedLine] = $changedCode;
+ }
eval(sprintf(implode("\n", $code), $class = 'Foo'.str_replace('.', '_', uniqid('', true))));
$signature = implode("\n", iterator_to_array($generateSignature(new \ReflectionClass($class))));
@@ -145,6 +153,10 @@ public function provideHashedSignature()
yield [0, 7, 'protected int $prot;'];
yield [0, 9, 'private string $priv;'];
}
+
+ yield [1, 17, 'public function ccc($bar = 187) {}'];
+ yield [1, 17, 'public function ccc($bar = ANOTHER_ONE_THAT_WILL_NEVER_BE_DEFINED_CCCCCCCCC) {}'];
+ yield [1, 17, null, static function () { \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }];
}
public function testEventSubscriber()
From b2ae60a73bb59c24da09ce8678290d939791ed0b Mon Sep 17 00:00:00 2001
From: Peter Kokot
Date: Fri, 29 Nov 2019 20:07:18 +0100
Subject: [PATCH 33/41] [Validator] Update Slovenian translations
---
.../Resources/translations/validators.sl.xlf | 48 +++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf
index 6f5fd98ca192e..cb12a8a9daa4d 100644
--- a/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf
+++ b/src/Symfony/Component/Validator/Resources/translations/validators.sl.xlf
@@ -318,6 +318,54 @@
Error
Napaka
+
+ This is not a valid UUID.
+ To ni veljaven UUID.
+
+
+ This value should be a multiple of {{ compared_value }}.
+ Ta vrednost bi morala biti večkratnik od {{ compared_value }}.
+
+
+ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}.
+ Ta poslovna identifikacijska koda (BIC) ni povezana z IBAN {{ iban }}.
+
+
+ This value should be valid JSON.
+ Ta vrednost bi morala biti veljaven JSON.
+
+
+ This collection should contain only unique elements.
+ Ta zbirka bi morala vsebovati samo edinstvene elemente.
+
+
+ This value should be positive.
+ Ta vrednost bi morala biti pozitivna.
+
+
+ This value should be either positive or zero.
+ Ta vrednost bi morala biti pozitivna ali enaka nič.
+
+
+ This value should be negative.
+ Ta vrednost bi morala biti negativna.
+
+
+ This value should be either negative or zero.
+ Ta vrednost bi morala biti negativna ali enaka nič.
+
+
+ This value is not a valid timezone.
+ Ta vrednost ni veljaven časovni pas.
+
+
+ This password has been leaked in a data breach, it must not be used. Please use another password.
+ To geslo je ušlo pri kršitvi varnosti podatkov in ga ne smete uporabljati. Prosimo, uporabite drugo geslo.
+
+
+ This value should be between {{ min }} and {{ max }}.
+ Ta vrednost bi morala biti med {{ min }} in {{ max }}.
+