Skip to content

Commit d11d98a

Browse files
Merge branch '5.0'
* 5.0: [appveyor] bump cache [Twig][Mime] Removed extra quotes in missing package exception message [DI] µfix Allowing empty secrets to be set [DI] add missing property declarations in InlineServiceConfigurator [DI] fix detecting short service syntax in yaml Supress error from fread when reading a unix pipe [HttpClient] Fix scoped client without query option configuration [Workflow] Use a strict comparison when retrieving raw marking in MarkingStore [Workflow] Use a strict comparison when retrieving raw markin in MarkingStore
2 parents 575a424 + 30dbf95 commit d11d98a

File tree

6 files changed

+46
-7
lines changed

6 files changed

+46
-7
lines changed

Command/SecretsSetCommand.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9696
$value = strtr(substr(base64_encode(random_bytes($random)), 0, $random), '+/', '-_');
9797
} elseif (!$file = $input->getArgument('file')) {
9898
$value = $io->askHidden('Please type the secret value');
99+
100+
if (null === $value) {
101+
$io->warning('No value provided: using empty string');
102+
$value = '';
103+
}
99104
} elseif ('-' === $file) {
100105
$value = file_get_contents('php://stdin');
101106
} elseif (is_file($file) && is_readable($file)) {
@@ -106,12 +111,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
106111
throw new \InvalidArgumentException(sprintf('File is not readable: "%s".', $file));
107112
}
108113

109-
if (null === $value) {
110-
$io->warning('No value provided, aborting.');
111-
112-
return 1;
113-
}
114-
115114
if ($vault->generateKeys()) {
116115
$io->success($vault->getLastMessage());
117116

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
13591359
->thenInvalid('Either "scope" or "base_uri" should be defined.')
13601360
->end()
13611361
->validate()
1362-
->ifTrue(function ($v) { return isset($v['query']) && !isset($v['base_uri']); })
1362+
->ifTrue(function ($v) { return !empty($v['query']) && !isset($v['base_uri']); })
13631363
->thenInvalid('"query" applies to "base_uri" but no base URI is defined.')
13641364
->end()
13651365
->children()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'http_client' => [
5+
'scoped_clients' => [
6+
'foo' => [
7+
'scope' => '.*',
8+
],
9+
],
10+
],
11+
]);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:http-client>
10+
<framework:scoped-client
11+
name="foo"
12+
scope=".*"
13+
/>
14+
</framework:http-client>
15+
</framework:config>
16+
</container>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
framework:
2+
http_client:
3+
scoped_clients:
4+
foo:
5+
scope: '.*'

Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,14 @@ public function testHttpClientDefaultOptions()
13531353
$this->assertSame(ScopingHttpClient::class, $container->getDefinition('foo')->getClass());
13541354
}
13551355

1356+
public function testScopedHttpClientWithoutQueryOption()
1357+
{
1358+
$container = $this->createContainerFromFile('http_client_scoped_without_query_option');
1359+
1360+
$this->assertTrue($container->hasDefinition('foo'), 'should have the "foo" service.');
1361+
$this->assertSame(ScopingHttpClient::class, $container->getDefinition('foo')->getClass());
1362+
}
1363+
13561364
public function testHttpClientOverrideDefaultOptions()
13571365
{
13581366
$container = $this->createContainerFromFile('http_client_override_default_options');

0 commit comments

Comments
 (0)