Skip to content

Commit 30dbf95

Browse files
Merge branch '4.4' into 5.0
* 4.4: [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 71a3b78 + 7522b55 commit 30dbf95

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
@@ -1345,7 +1345,7 @@ private function addHttpClientSection(ArrayNodeDefinition $rootNode)
13451345
->thenInvalid('Either "scope" or "base_uri" should be defined.')
13461346
->end()
13471347
->validate()
1348-
->ifTrue(function ($v) { return isset($v['query']) && !isset($v['base_uri']); })
1348+
->ifTrue(function ($v) { return !empty($v['query']) && !isset($v['base_uri']); })
13491349
->thenInvalid('"query" applies to "base_uri" but no base URI is defined.')
13501350
->end()
13511351
->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
@@ -1346,6 +1346,14 @@ public function testHttpClientDefaultOptions()
13461346
$this->assertSame(ScopingHttpClient::class, $container->getDefinition('foo')->getClass());
13471347
}
13481348

1349+
public function testScopedHttpClientWithoutQueryOption()
1350+
{
1351+
$container = $this->createContainerFromFile('http_client_scoped_without_query_option');
1352+
1353+
$this->assertTrue($container->hasDefinition('foo'), 'should have the "foo" service.');
1354+
$this->assertSame(ScopingHttpClient::class, $container->getDefinition('foo')->getClass());
1355+
}
1356+
13491357
public function testHttpClientOverrideDefaultOptions()
13501358
{
13511359
$container = $this->createContainerFromFile('http_client_override_default_options');

0 commit comments

Comments
 (0)