8000 Merge branch '5.4' into 6.4 · devloop42/symfony@a7e13a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit a7e13a0

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: Add missing Albanian translations for Security and Validator components suppress proc_open errors [DependencyInjection] Fix `XmlFileLoader` not respecting when env for services
2 parents 15b4d93 + fe74ff3 commit a7e13a0

File tree

9 files changed

+103
-14
lines changed

9 files changed

+103
-14
lines changed

src/Symfony/Component/Console/Terminal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ private static function readFromProcess(string|array $command): ?string
217217

218218
$cp = \function_exists('sapi_windows_cp_set') ? sapi_windows_cp_get() : 0;
219219

220-
if (!$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true])) {
220+
if (!$process = @proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true])) {
221221
return null;
222222
8000 }
223223

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ private function parseImports(\DOMDocument $xml, string $file, ?\DOMNode $root =
118118
$xpath = new \DOMXPath($xml);
119119
$xpath->registerNamespace('container', self::NS);
120120

121-
if (false === $imports = $xpath->query('.//container:imports/container:import', $root)) {
121+
if (false === $imports = $xpath->query('./container:imports/container:import', $root)) {
122122
return;
123123
}
124124

@@ -134,14 +134,14 @@ private function parseDefinitions(\DOMDocument $xml, string $file, Definition $d
134134
$xpath = new \DOMXPath($xml);
135135
$xpath->registerNamespace('container', self::NS);
136136

137-
if (false === $services = $xpath->query('.//container:services/container:service|.//container:services/container:prototype|.//container:services/container:stack', $root)) {
137+
if (false === $services = $xpath->query('./container:services/container:service|./container:services/container:prototype|./container:services/container:stack', $root)) {
138138
return;
139139
}
140140
$this->setCurrentDir(\dirname($file));
141141

142142
$this->instanceof = [];
143143
$this->isLoadingInstanceof = true;
144-
$instanceof = $xpath->query('.//container:services/container:instanceof', $root);
144+
$instanceof = $xpath->query('./container:services/container:instanceof', $root);
145145
foreach ($instanceof as $service) {
146146
$this->setDefinition((string) $service->getAttribute('id'), $this->parseDefinition($service, $file, new Definition()));
147147
}
@@ -192,7 +192,7 @@ private function getServiceDefaults(\DOMDocument $xml, string $file, ?\DOMNode $
192192
$xpath = new \DOMXPath($xml);
193193
$xpath->registerNamespace('container', self::NS);
194194

195-
if (null === $defaultsNode = $xpath->query('.//container:services/container:defaults', $root)->item(0)) {
195+
if (null === $defaultsNode = $xpath->query('./container:services/container:defaults', $root)->item(0)) {
196196
return new Definition();
197197
}
198198

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
interface RemoteCaller
15+
{
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
class RemoteCallerHttp implements RemoteCaller
15+
{
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
13+
14+
class RemoteCallerSocket implements RemoteCaller
15+
{
16+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
6+
<services>
7+
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCaller"
8+
alias="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerHttp"/>
9+
10+
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerHttp"
11+
class="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerHttp"/>
12+
13+
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerSocket"
14+
class="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerSocket"/>
15+
</services>
16+
17+
<when env="dev">
18+
<services>
19+
<service id="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCaller"
20+
alias="Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerSocket"/>
21+
</services>
22+
</when>
23+
</container>

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooWithAbstractArgument;
4646
use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy;
4747
use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype;
48+
use Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCaller;
49+
use Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerHttp;
50+
use Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerSocket;
4851
use Symfony\Component\ExpressionLanguage\Expression;
4952

5053
class XmlFileLoaderTest extends TestCase
@@ -1262,10 +1265,25 @@ public function testStaticConstructor()
12621265
public function testStaticConstructorWithFactoryThrows()
12631266
{
12641267
$container = new ContainerBuilder();
1265-
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
1268+
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath . '/xml'));
12661269

12671270
$this->expectException(LogicException::class);
12681271
$this->expectExceptionMessage('The "static_constructor" service cannot declare a factory as well as a constructor.');
12691272
$loader->load('static_constructor_and_factory.xml');
12701273
}
1274+
1275+
public function testLoadServicesWithEnvironment()
1276+
{
1277+
$container = new ContainerBuilder();
1278+
1279+
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'), 'prod');
1280+
$loader->load('when-env-services.xml');
1281+
1282+
self::assertInstanceOf(RemoteCallerHttp::class, $container->get(RemoteCaller::class));
1283+
1284+
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'), 'dev');
1285+
$loader->load('when-env-services.xml');
1286+
1287+
self::assertInstanceOf(RemoteCallerSocket::class, $container->get(RemoteCaller::class));
1288+
}
12711289
}

src/Symfony/Component/Security/Core/Resources/translations/security.sq.xlf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</trans-unit>
2121
<trans-unit id="5">
2222
<source>Cookie has already been used by someone else.</source>
23-
<target>Cookie është përdorur tashmë nga dikush tjetër.</target>
23+
<target>Cookie është përdorur tashmë nga dikush tjetër.</target>
2424
</trans-unit>
2525
<trans-unit id="6">
2626
<source>Not privileged to request the resource.</source>
@@ -76,7 +76,7 @@
7676
</trans-unit>
7777
<trans-unit id="20">
7878
<source>Too many failed login attempts, please try again in %minutes% minutes.</source>
79-
<target state="needs-review-translation">Shumë përpjekje të pasuksesshme për t'u identifikuar, ju lutemi provoni përsëri pas %minutes% minutash.</target>
79+
<target>Shumë përpjekje të dështuara për identifikim, ju lutemi provoni përsëri pas %minutes% minutash.</target>
8080
</trans-unit>
8181
</body>
8282
</file>

src/Symfony/Component/Validator/Resources/translations/validators.sq.xlf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,27 +453,27 @@
453453
</trans-unit>
454454
<trans-unit id="114">
455455
<source>This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.</source>
456-
<target state="needs-translation">This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.</target>
456+
<target>Kjo vlerë është shumë e shkurtër. Duhet të përmbajë të paktën një fjalë.|Kjo vlerë është shumë e shkurtër. Duhet të përmbajë të paktën {{ min }} fjalë.</target>
457457
</trans-unit>
458458
<trans-unit id="115">
459459
<source>This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.</source>
460-
<target state="needs-translation">This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.</target>
460+
<target>Kjo vlerë është shumë e gjatë. Duhet të përmbajë një fjalë.|Kjo vlerë është shumë e gjatë. Duhet të përmbajë {{ max }} fjalë ose më pak.</target>
461461
</trans-unit>
462462
<trans-unit id="116">
463463
<source>This value does not represent a valid week in the ISO 8601 format.</source>
464-
<target state="needs-translation">This value does not represent a valid week in the ISO 8601 format.</target>
464+
<target>Kjo vlerë nuk përfaqëson një javë të vlefshme në formatin ISO 8601.</target>
465465
</trans-unit>
466466
<trans-unit id="117">
467467
<source>This value is not a valid week.</source>
468-
<target state="needs-translation">This value is not a valid week.</target>
468+
<target>Kjo vlerë nuk është një javë e vlefshme.</target>
469469
</trans-unit>
470470
<trans-unit id="118">
471471
<source>This value should not be before week "{{ min }}".</source>
472-
<target state="needs-translation">This value should not be before week "{{ min }}".</target>
472+
<target>Kjo vlerë nuk duhet të jetë para javës "{{ min }}".</target>
473473
</trans-unit>
474474
<trans-unit id="119">
475475
<source>This value should not be after week "{{ max }}".</source>
476-
<target state="needs-translation">This value should not be after week "{{ max }}".</target>
476+
<target>Kjo vlerë nuk duhet të jetë pas javës "{{ max }}".</target>
477477
</trans-unit>
478478
</body>
479479
</file>

0 commit comments

Comments
 (0)
0