Skip to content

Commit 50454b4

Browse files
Merge branch '6.3' into 6.4
* 6.3: append instead of replacing potentially non-existent named-arguments [Validator] added missing Polish translation add translations for the MacAddress constraint remove invalid changelog entry Added missing Serbian (sr_Latn) translations [Cache][DependencyInjection][Lock][Mailer][Messenger][Notifier][Translation] Url decode username and passwords from `parse_url()` results [Security] added missing Albanian translations [Validator] Add missing Hungarian translation [Serializer] Fix using deserialization path [Validator] Add missing hr translation
2 parents 712ccf5 + 11b54e6 commit 50454b4

File tree

23 files changed

+213
-113
lines changed

23 files changed

+213
-113
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,27 +2872,27 @@ private function registerNotifierConfiguration(array $config, ContainerBuilder $
28722872

28732873
if (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', NotifierBridge\Mercure\MercureTransportFactory::class, $parentPackages) && ContainerBuilder::willBeAvailable('symfony/mercure-bundle', MercureBundle::class, $parentPackages) && \in_array(MercureBundle::class, $container->getParameter('kernel.bundles'), true)) {
28742874
$container->getDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class])
2875-
->replaceArgument('$registry', new Reference(HubRegistry::class))
2876-
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2877-
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2875+
->replaceArgument(0, new Reference(HubRegistry::class))
2876+
->replaceArgument(1, new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2877+
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
28782878
} elseif (ContainerBuilder::willBeAvailable('symfony/mercure-notifier', NotifierBridge\Mercure\MercureTransportFactory::class, $parentPackages)) {
28792879
$container->removeDefinition($classToServices[NotifierBridge\Mercure\MercureTransportFactory::class]);
28802880
}
28812881

28822882
if (ContainerBuilder::willBeAvailable('symfony/fake-chat-notifier', NotifierBridge\FakeChat\FakeChatTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
28832883
$container->getDefinition($classToServices[NotifierBridge\FakeChat\FakeChatTransportFactory::class])
2884-
->replaceArgument('$mailer', new Reference('mailer'))
2885-
->replaceArgument('$logger', new Reference('logger'))
2886-
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2887-
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2884+
->replaceArgument(0, new Reference('mailer'))
2885+
->replaceArgument(1, new Reference('logger'))
2886+
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2887+
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
28882888
}
28892889

28902890
if (ContainerBuilder::willBeAvailable('symfony/fake-sms-notifier', NotifierBridge\FakeSms\FakeSmsTransportFactory::class, ['symfony/framework-bundle', 'symfony/notifier', 'symfony/mailer'])) {
28912891
$container->getDefinition($classToServices[NotifierBridge\FakeSms\FakeSmsTransportFactory::class])
2892-
->replaceArgument('$mailer', new Reference('mailer'))
2893-
->replaceArgument('$logger', new Reference('logger'))
2894-
->replaceArgument('$client', new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2895-
->replaceArgument('$dispatcher', new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
2892+
->replaceArgument(0, new Reference('mailer'))
2893+
->replaceArgument(1, new Reference('logger'))
2894+
->addArgument(new Reference('event_dispatcher', ContainerBuilder::NULL_ON_INVALID_REFERENCE))
2895+
->addArgument(new Reference('http_client', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
28962896
}
28972897

28982898
if (isset($config['admin_recipients'])) {

src/Symfony/Component/Cache/Adapter/MemcachedAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public static function createConnection(#[\SensitiveParameter] array|string $ser
114114
$params = preg_replace_callback('#^memcached:(//)?(?:([^@]*+)@)?#', function ($m) use (&$username, &$password) {
115115
if (!empty($m[2])) {
116116
[$username, $password] = explode(':', $m[2], 2) + [1 => null];
117+
$username = rawurldecode($username);
118+
$password = null !== $password ? rawurldecode($password) : null;
117119
}
118120

119121
return 'file:'.($m[1] ?? '');

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,15 +286,15 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
286286
}
287287

288288
if ('url' === $prefix) {
289-
$parsedEnv = parse_url($env);
289+
$params = parse_url($env);
290290

291-
if (false === $parsedEnv) {
291+
if (false === $params) {
292292
throw new RuntimeException(sprintf('Invalid URL in env var "%s".', $name));
293293
}
294-
if (!isset($parsedEnv['scheme'], $parsedEnv['host'])) {
294+
if (!isset($params['scheme'], $params['host'])) {
295295
throw new RuntimeException(sprintf('Invalid URL env var "%s": schema and host expected, "%s" given.', $name, $env));
296296
}
297-
$parsedEnv += [
297+
$params += [
298298
'port' => null,
299299
'user' => null,
300300
'pass' => null,
@@ -303,10 +303,13 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv): mixed
303303
'fragment' => null,
304304
];
305305

306+
$params['user'] = null !== $params['user'] ? rawurldecode($params['user']) : null;
307+
$params['pass'] = null !== $params['pass'] ? rawurldecode($params['pass']) : null;
308+
306309
// remove the '/' separator
307-
$parsedEnv['path'] = '/' === ($parsedEnv['path'] ?? '/') ? '' : substr($parsedEnv['path'], 1);
310+
$params['path'] = '/' === ($params['path'] ?? '/') ? '' : substr($params['path'], 1);
308311

309-
return $parsedEnv;
312+
return $params;
310313
}
311314

312315
if ('query_string' === $prefix) {

src/Symfony/Component/Lock/Store/MongoDbStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ private function skimUri(string $uri): string
157157
throw new InvalidArgumentException(sprintf('The given MongoDB Connection URI "%s" is invalid. Expecting "mongodb://" or "mongodb+srv://".', $uri));
158158
}
159159

160-
if (false === $parsedUrl = parse_url($uri)) {
160+
if (false === $params = parse_url($uri)) {
161161
throw new InvalidArgumentException(sprintf('The given MongoDB Connection URI "%s" is invalid.', $uri));
162162
}
163-
$pathDb = ltrim($parsedUrl['path'] ?? '', '/') ?: null;
163+
$pathDb = ltrim($params['path'] ?? '', '/') ?: null;
164164
if (null !== $pathDb) {
165165
$this->options['database'] = $pathDb;
166166
}

src/Symfony/Component/Mailer/Transport/Dsn.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,24 @@ public function __construct(string $scheme, string $host, string $user = null, #
3737

3838
public static function fromString(#[\SensitiveParameter] string $dsn): self
3939
{
40-
if (false === $parsedDsn = parse_url($dsn)) {
40+
if (false === $params = parse_url($dsn)) {
4141
throw new InvalidArgumentException('The mailer DSN is invalid.');
4242
}
4343

44-
if (!isset($parsedDsn['scheme'])) {
44+
if (!isset($params['scheme'])) {
4545
throw new InvalidArgumentException('The mailer DSN must contain a scheme.');
4646
}
4747

48-
if (!isset($parsedDsn['host'])) {
48+
if (!isset($params['host'])) {
4949
throw new InvalidArgumentException('The mailer DSN must contain a host (use "default" by default).');
5050
}
5151

52-
$user = '' !== ($parsedDsn['user'] ?? '') ? urldecode($parsedDsn['user']) : null;
53-
$password = '' !== ($parsedDsn['pass'] ?? '') ? urldecode($parsedDsn['pass']) : null;
54-
$port = $parsedDsn['port'] ?? null;
55-
parse_str($parsedDsn['query'] ?? '', $query);
52+
$user = '' !== ($params['user'] ?? '') ? rawurldecode($params['user']) : null;
53+
$password = '' !== ($params['pass'] ?? '') ? rawurldecode($params['pass']) : null;
54+
$port = $params['port'] ?? null;
55+
parse_str($params['query'] ?? '', $query);
5656

57-
return new self($parsedDsn['scheme'], $parsedDsn['host'], $user, $password, $port, $query);
57+
return new self($params['scheme'], $params['host'], $user, $password, $port, $query);
5858
}
5959

6060
public function getScheme(): string

src/Symfony/Component/Messenger/Bridge/AmazonSqs/Transport/Connection.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ public function __destruct()
105105
*/
106106
public static function fromDsn(#[\SensitiveParameter] string $dsn, array $options = [], HttpClientInterface $client = null, LoggerInterface $logger = null): self
107107
{
108-
if (false === $parsedUrl = parse_url($dsn)) {
108+
if (false === $params = parse_url($dsn)) {
109109
throw new InvalidArgumentException('The given Amazon SQS DSN is invalid.');
110110
}
111111

112112
$query = [];
113-
if (isset($parsedUrl['query'])) {
114-
parse_str($parsedUrl['query'], $query);
113+
if (isset($params['query'])) {
114+
parse_str($params['query'], $query);
115115
}
116116

117117
// check for extra keys in options
@@ -138,8 +138,8 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
138138

139139
$clientConfiguration = [
140140
'region' => $options['region'],
141-
'accessKeyId' => urldecode($parsedUrl['user'] ?? '') ?: $options['access_key'] ?? self::DEFAULT_OPTIONS['access_key'],
142-
'accessKeySecret' => urldecode($parsedUrl['pass'] ?? '') ?: $options['secret_key'] ?? self::DEFAULT_OPTIONS['secret_key'],
141+
'accessKeyId' => rawurldecode($params['user'] ?? '') ?: $options['access_key'] ?? self::DEFAULT_OPTIONS['access_key'],
142+
'accessKeySecret' => rawurldecode($params['pass'] ?? '') ?: $options['secret_key'] ?? self::DEFAULT_OPTIONS['secret_key'],
143143
];
144144
if (null !== $options['session_token']) {
145145
$clientConfiguration['sessionToken'] = $options['session_token'];
@@ -149,16 +149,16 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
149149
}
150150
unset($query['region']);
151151

152-
if ('default' !== ($parsedUrl['host'] ?? 'default')) {
153-
$clientConfiguration['endpoint'] = sprintf('%s://%s%s', ($query['sslmode'] ?? null) === 'disable' ? 'http' : 'https', $parsedUrl['host'], ($parsedUrl['port'] ?? null) ? ':'.$parsedUrl['port'] : '');
154-
if (preg_match(';^sqs\.([^\.]++)\.amazonaws\.com$;', $parsedUrl['host'], $matches)) {
152+
if ('default' !== ($params['host'] ?? 'default')) {
153+
$clientConfiguration['endpoint'] = sprintf('%s://%s%s', ($query['sslmode'] ?? null) === 'disable' ? 'http' : 'https', $params['host'], ($params['port'] ?? null) ? ':'.$params['port'] : '');
154+
if (preg_match(';^sqs\.([^\.]++)\.amazonaws\.com$;', $params['host'], $matches)) {
155155
$clientConfiguration['region'] = $matches[1];
156156
}
157157
} elseif (self::DEFAULT_OPTIONS['endpoint'] !== $options['endpoint'] ?? self::DEFAULT_OPTIONS['endpoint']) {
158158
$clientConfiguration['endpoint'] = $options['endpoint'];
159159
}
160160

161-
$parsedPath = explode('/', ltrim($parsedUrl['path'] ?? '/', '/'));
161+
$parsedPath = explode('/', ltrim($params['path'] ?? '/', '/'));
162162
if (\count($parsedPath) > 0 && !empty($queueName = end($parsedPath))) {
163163
$configuration['queue_name'] = $queueName;
164164
}
@@ -168,11 +168,11 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
168168
// https://sqs.REGION.amazonaws.com/ACCOUNT/QUEUE
169169
$queueUrl = null;
170170
if (
171-
'https' === $parsedUrl['scheme']
172-
&& ($parsedUrl['host'] ?? 'default') === "sqs.{$clientConfiguration['region']}.amazonaws.com"
173-
&& ($parsedUrl['path'] ?? '/') === "/{$configuration['account']}/{$configuration['queue_name']}"
171+
'https' === $params['scheme']
172+
&& ($params['host'] ?? 'default') === "sqs.{$clientConfiguration['region']}.amazonaws.com"
173+
&& ($params['path'] ?? '/') === "/{$configuration['account']}/{$configuration['queue_name']}"
174174
) {
175-
$queueUrl = 'https://'.$parsedUrl['host'].$parsedUrl['path'];
175+
$queueUrl = 'https://'.$params['host'].$params['path'];
176176
}
177177

178178
return new self($configuration, new SqsClient($clientConfiguration, null, $client, $logger), $queueUrl);

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,24 +162,24 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
162162
*/
163163
public static function fromDsn(#[\SensitiveParameter] string $dsn, array $options = [], AmqpFactory $amqpFactory = null): self
164164
{
165-
if (false === $parsedUrl = parse_url($dsn)) {
165+
if (false === $params = parse_url($dsn)) {
166166
// this is a valid URI that parse_url cannot handle when you want to pass all parameters as options
167167
if (!\in_array($dsn, ['amqp://', 'amqps://'])) {
168168
throw new InvalidArgumentException('The given AMQP DSN is invalid.');
169169
}
170170

171-
$parsedUrl = [];
171+
$params = [];
172172
}
173173

174174
$useAmqps = str_starts_with($dsn, 'amqps://');
175-
$pathParts = isset($parsedUrl['path']) ? explode('/', trim($parsedUrl['path'], '/')) : [];
175+
$pathParts = isset($params['path']) ? explode('/', trim($params['path'], '/')) : [];
176176
$exchangeName = $pathParts[1] ?? 'messages';
177-
parse_str($parsedUrl['query'] ?? '', $parsedQuery);
177+
parse_str($params['query'] ?? '', $parsedQuery);
178178
$port = $useAmqps ? 5671 : 5672;
179179

180180
$amqpOptions = array_replace_recursive([
181-
'host' => $parsedUrl['host'] ?? 'localhost',
182-
'port' => $parsedUrl['port'] ?? $port,
181+
'host' => $params['host'] ?? 'localhost',
182+
'port' => $params['port'] ?? $port,
183183
'vhost' => isset($pathParts[0]) ? urldecode($pathParts[0]) : '/',
184184
'exchange' => [
185185
'name' => $exchangeName,
@@ -188,12 +188,12 @@ public static function fromDsn(#[\SensitiveParameter] string $dsn, array $option
188188

189189
self::validateOptions($amqpOptions);
190190

191-
if (isset($parsedUrl['user'])) {
192-
$amqpOptions['login'] = urldecode($parsedUrl['user']);
191+
if (isset($params['user'])) {
192+
$amqpOptions['login'] = rawurldecode($params['user']);
193193
}
194194

195-
if (isset($parsedUrl['pass'])) {
196-
$amqpOptions['password'] = urldecode($parsedUrl['pass']);
195+
if (isset($params['pass'])) {
196+
$amqpOptions['password'] = rawurldecode($params['pass']);
197197
}
198198

199199
if (!isset($amqpOptions['queues'])) {

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,16 @@ public function getConfiguration(): array
8888

8989
public static function buildConfiguration(#[\SensitiveParameter] string $dsn, array $options = []): array
9090
{
91-
if (false === $components = parse_url($dsn)) {
91+
if (false === $params = parse_url($dsn)) {
9292
throw new InvalidArgumentException('The given Doctrine Messenger DSN is invalid.');
9393
}
9494

9595
$query = [];
96-
if (isset($components['query'])) {
97-
parse_str($components['query'], $query);
96+
if (isset($params['query'])) {
97+
parse_str($params['query'], $query);
9898
}
9999

100-
$configuration = ['connection' => $components['host']];
100+
$configuration = ['connection' => $params['host']];
101101
$configuration += $query + $options + static::DEFAULT_OPTIONS;
102102

103103
$configuration['auto_setup'] = filter_var($configuration['auto_setup'], \FILTER_VALIDATE_BOOL);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy