Skip to content

Commit fadce17

Browse files
committed
Merge branch '5.4' into 6.4
* 5.4: Update configuration path in help message [Validator] Review Albanian translation [Process] Fix Inconsistent Exit Status in proc_get_status for PHP Versions Below 8.3 [Validator] Update Czech (cz) translation Sync translations Review portuguese translations [Validator] Fix fields without constraints in `Collection` deal with fields for which no constraints have been configured
2 parents 7cbf1fc + 6986ab8 commit fadce17

File tree

9 files changed

+161
-22
lines changed

9 files changed

+161
-22
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<header>
55
<note>
66
Për fjalët e huaja, të cilat nuk kanë përkthim të drejtpërdrejtë, ju lutemi të ndiqni rregullat e mëposhtme:
7-
a) në rast se emri është akronim i përdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia gjykohet sipas rastit. Shembull: JSON-i (mashkullore)
8-
b) në rast se emri është akronim i papërdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia është femërore. Shembull: URL-ja (femërore)
9-
c) në rast se emri duhet lakuar për shkak të rasës në fjali, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Shembull: host-i, prej host-it
10-
d) në rast se emri nuk duhet lakuar për shkak të trajtës në fjali, atëherë, emri rrethohet me thonjëzat “”. Shembull: “locale”
7+
a) në rast se emri është akronim i përdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia gjykohet sipas rastit. Shembull: JSON-i (mashkullore)
8+
b) në rast se emri është akronim i papërdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia është femërore. Shembull: URL-ja (femërore)
9+
c) në rast se emri duhet lakuar për shkak të rasës në fjali, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Shembull: host-i, prej host-it
10+
d) në rast se emri nuk duhet lakuar për shkak të trajtës në fjali, atëherë, emri rrethohet me thonjëzat “”. Shembull: “locale”
1111
</note>
1212
</header>
1313
<body>

src/Symfony/Component/PasswordHasher/Command/UserPasswordHashCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function configure(): void
6565
Suppose that you have the following security configuration in your application:
6666
6767
<comment>
68-
# app/config/security.yml
68+
# config/packages/security.yml
6969
security:
7070
password_hashers:
7171
Symfony\Component\Security\Core\User\InMemoryUser: plaintext

src/Symfony/Component/Process/Process.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class Process implements \IteratorAggregate
8080
private WindowsPipes|UnixPipes $processPipes;
8181

8282
private ?int $latestSignal = null;
83+
private ?int $cachedExitCode = null;
8384

8485
private static ?bool $sigchild = null;
8586

@@ -1291,6 +1292,19 @@ protected function updateStatus(bool $blocking)
12911292
$this->processInformation = proc_get_status($this->process);
12921293
$running = $this->processInformation['running'];
12931294

1295+
// In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call.
1296+
// Subsequent calls return -1 as the process is discarded. This workaround caches the first
1297+
// retrieved exit status for consistent results in later calls, mimicking PHP 8.3 behavior.
1298+
if (\PHP_VERSION_ID < 80300) {
1299+
if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) {
1300+
$this->cachedExitCode = $this->processInformation['exitcode'];
1301+
}
1302+
1303+
if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) {
1304+
$this->processInformation['exitcode'] = $this->cachedExitCode;
1305+
}
1306+
}
1307+
12941308
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
12951309

12961310
if ($this->fallbackStatus && $this->isSigchildEnabled()) {

src/Symfony/Component/Process/Tests/ProcessTest.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,60 @@ public function testEnvCaseInsensitiveOnWindows()
15531553
}
15541554
}
15551555

1556+
public function testMultipleCallsToProcGetStatus()
1557+
{
1558+
$process = $this->getProcess('echo foo');
1559+
$process->start(static function () use ($process) {
1560+
return $process->isRunning();
1561+
});
1562+
while ($process->isRunning()) {
1563+
usleep(1000);
1564+
}
1565+
$this->assertSame(0, $process->getExitCode());
1566+
}
1567+
1568+
public function testFailingProcessWithMultipleCallsToProcGetStatus()
1569+
{
1570+
$process = $this->getProcess('exit 123');
1571+
$process->start(static function () use ($process) {
1572+
return $process->isRunning();
1573+
});
1574+
while ($process->isRunning()) {
1575+
usleep(1000);
1576+
}
1577+
$this->assertSame(123, $process->getExitCode());
1578+
}
1579+
1580+
/**
1581+
* @group slow
1582+
*/
1583+
public function testLongRunningProcessWithMultipleCallsToProcGetStatus()
1584+
{
1585+
$process = $this->getProcess('php -r "sleep(1); echo \'done\';"');
1586+
$process->start(static function () use ($process) {
1587+
return $process->isRunning();
1588+
});
1589+
while ($process->isRunning()) {
1590+
usleep(1000);
1591+
}
1592+
$this->assertSame(0, $process->getExitCode());
1593+
}
1594+
1595+
/**
1596+
* @group slow
1597+
*/
1598+
public function testLongRunningProcessWithMultipleCallsToProcGetStatusError()
1599+
{
1600+
$process = $this->getProcess('php -r "sleep(1); echo \'failure\'; exit(123);"');
1601+
$process->start(static function () use ($process) {
1602+
return $process->isRunning();
1603+
});
1604+
while ($process->isRunning()) {
1605+
usleep(1000);
1606+
}
1607+
$this->assertSame(123, $process->getExitCode());
1608+
}
1609+
15561610
/**
15571611
* @group transient-on-windows
15581612
*/

src/Symfony/Component/Validator/Constraints/Collection.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Collection extends Composite
4444

4545
public function __construct(mixed $fields = null, ?array $groups = null, mixed $payload = null, ?bool $allowExtraFields = null, ?bool $allowMissingFields = null, ?string $extraFieldsMessage = null, ?string $missingFieldsMessage = null)
4646
{
47-
if (\is_array($fields) && ([] === $fields || ($firstField = reset($fields)) instanceof Constraint || ($firstField[0] ?? null) instanceof Constraint)) {
47+
if (self::isFieldsOption($fields)) {
4848
$fields = ['fields' => $fields];
4949
}
5050

@@ -89,4 +89,31 @@ protected function getCompositeOption(): string
8989
{
9090
return 'fields';
9191
}
92+
93+
private static function isFieldsOption($options): bool
94+
{
95+
if (!\is_array($options)) {
96+
return false;
97+
}
98+
99+
foreach ($options as $optionOrField) {
100+
if ($optionOrField instanceof Constraint) {
101+
return true;
102+
}
103+
104+
if (null === $optionOrField) {
105+
continue;
106+
}
107+
108+
if (!\is_array($optionOrField)) {
109+
return false;
110+
}
111+
112+
if ($optionOrField && !($optionOrField[0] ?? null) instanceof Constraint) {
113+
return false;
114+
}
115+
}
116+
117+
return true;
118+
}
92119
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</trans-unit>
137137
<trans-unit id="37" resname="This is not a valid IP address.">
138138
<source>This value is not a valid IP address.</source>
139-
<target state="needs-review-translation">Tato hodnota není platnou IP adresou.</target>
139+
<target>Tato hodnota není platnou IP adresou.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -192,7 +192,7 @@
192192
</trans-unit>
193193
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194194
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195-
<target state="needs-review-translation">V php.ini nebyla nastavena cesta k dočasnému adresáři, nebo nastavený adresář neexistuje.</target>
195+
<target>V php.ini nebyla nastavena cesta k dočasnému adresáři, nebo nastavený adresář neexistuje.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226226
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227-
<target state="needs-review-translation">Tato hodnota není platným Mezinárodním bankovním číslem účtu (IBAN).</target>
227+
<target>Tato hodnota není platným Mezinárodním bankovním číslem účtu (IBAN).</target>
228228
</trans-unit>
229229
<trans-unit id="60">
230230
<source>This value is not a valid ISBN-10.</source>
@@ -312,15 +312,15 @@
312312
</trans-unit>
313313
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314314
<source>This value is not a valid Business Identifier Code (BIC).</source>
315-
<target state="needs-review-translation">Tato hodnota není platným Kódem obchodního identifikátoru (BIC).</target>
315+
<target>Tato hodnota není platným Kódem obchodního identifikátoru (BIC).</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Chyba</target>
320320
</trans-unit>
321321
<trans-unit id="83" resname="This is not a valid UUID.">
322322
<source>This value is not a valid UUID.</source>
323-
<target state="needs-review-translation">Tato hodnota není platným UUID.</target>
323+
<target>Tato hodnota není platným UUID.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -436,7 +436,7 @@
436436
</trans-unit>
437437
<trans-unit id="112">
438438
<source>This value is not a valid MAC address.</source>
439-
<target state="needs-review-translation">Tato hodnota není platnou MAC adresou.</target>
439+
<target>Tato hodnota není platnou MAC adresou.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
</trans-unit>
137137
<trans-unit id="37" resname="This is not a valid IP address.">
138138
<source>This value is not a valid IP address.</source>
139-
<target state="needs-review-translation">Este valor não é um endereço IP válido.</target>
139+
<target>Este valor não é um endereço IP válido.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -192,7 +192,7 @@
192192
</trans-unit>
193193
<trans-unit id="51" resname="No temporary folder was configured in php.ini.">
194194
<source>No temporary folder was configured in php.ini, or the configured folder does not exist.</source>
195-
<target state="needs-review-translation">Nenhuma pasta temporária foi configurada no php.ini, ou a pasta configurada não existe.</target>
195+
<target>Nenhuma pasta temporária foi configurada no php.ini, ou a pasta configurada não existe.</target>
196196
</trans-unit>
197197
<trans-unit id="52">
198198
<source>Cannot write temporary file to disk.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59" resname="This is not a valid International Bank Account Number (IBAN).">
226226
<source>This value is not a valid International Bank Account Number (IBAN).</source>
227-
<target state="needs-review-translation">Este valor não é um Número de Conta Bancária Internacional (IBAN) válido.</target>
227+
<target>Este valor não é um Número de Conta Bancária Internacional (IBAN) válido.</target>
228228
</trans-unit>
229229
<trans-unit id="60">
230230
<source>This value is not a valid ISBN-10.</source>
@@ -312,15 +312,15 @@
312312
</trans-unit>
313313
<trans-unit id="81" resname="This is not a valid Business Identifier Code (BIC).">
314314
<source>This value is not a valid Business Identifier Code (BIC).</source>
315-
<target state="needs-review-translation">Este valor não é um Código de Identificação de Negócio (BIC) válido.</target>
315+
<target>Este valor não é um Código de Identificação de Negócio (BIC) válido.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Erro</target>
320320
</trans-unit>
321321
<trans-unit id="83" resname="This is not a valid UUID.">
322322
<source>This value is not a valid UUID.</source>
323-
<target state="needs-review-translation">Este valor não é um UUID válido.</target>
323+
<target>Este valor não é um UUID válido.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
<header>
55
<note>
66
Për fjalët e huaja, të cilat nuk kanë përkthim të drejtpërdrejtë, ju lutemi të ndiqni rregullat e mëposhtme:
7-
a) në rast se emri është akronim i përdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia gjykohet sipas rastit. Shembull: JSON (mashkullore)
8-
b) në rast se emri është akronim i papërdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia është femërore. Shembull: URL (femërore)
9-
c) në rast se emri duhet lakuar për shkak të rasës në fjali, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Shembull: host-i, prej host-it
10-
d) në rast se emri nuk duhet lakuar për shkak të trajtës në fjali, atëherë, emri rrethote me thonjëzat “”. Shembull: “locale”
7+
a) në rast se emri është akronim i përdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia gjykohet sipas rastit. Shembull: JSON (mashkullore)
8+
b) në rast se emri është akronim i papërdorur gjerësisht si i përveçëm, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Gjinia është femërore. Shembull: URL (femërore)
9+
c) në rast se emri duhet lakuar për shkak të rasës në fjali, atëherë, emri lakohet pa thonjëza dhe mbaresa shkruhet me vizë ndarëse. Shembull: host-i, prej host-it
10+
d) në rast se emri nuk duhet lakuar për shkak të trajtës në fjali, atëherë, emri rrethote me thonjëzat “”. Shembull: “locale”
1111
</note>
1212
</header>
1313
<body>
@@ -329,7 +329,7 @@
329329
</trans-unit>
330330
<trans-unit id="83" resname="This is not a valid UUID.">
331331
<source>This value is not a valid UUID.</source>
332-
<target state="needs-review-translation">Kjo vlerë nuk është një UUID e vlefshme.</target>
332+
<target>Kjo vlerë nuk është një UUID e vlefshme.</target>
333333
</trans-unit>
334334
<trans-unit id="84">
335335
<source>This value should be a multiple of {{ compared_value }}.</source>

src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,50 @@ public function testEmptyFieldsInOptions()
170170
'extraFieldsMessage' => 'foo bar baz',
171171
]);
172172

173+
$this->assertSame([], $constraint->fields);
174+
$this->assertTrue($constraint->allowExtraFields);
175+
$this->assertSame('foo bar baz', $constraint->extraFieldsMessage);
176+
}
177+
178+
/**
179+
* @testWith [[]]
180+
* [null]
181+
*/
182+
public function testEmptyConstraintListForField(?array $fieldConstraint)
183+
{
184+
$constraint = new Collection(
185+
[
186+
'foo' => $fieldConstraint,
187+
],
188+
null,
189+
null,
190+
true,
191+
null,
192+
'foo bar baz'
193+
);
194+
195+
$this->assertArrayHasKey('foo', $constraint->fields);
196+
$this->assertInstanceOf(Required::class, $constraint->fields['foo']);
197+
$this->assertTrue($constraint->allowExtraFields);
198+
$this->assertSame('foo bar baz', $constraint->extraFieldsMessage);
199+
}
200+
201+
/**
202+
* @testWith [[]]
203+
* [null]
204+
*/
205+
public function testEmptyConstraintListForFieldInOptions(?array $fieldConstraint)
206+
{
207+
$constraint = new Collection([
208+
'fields' => [
209+
'foo' => $fieldConstraint,
210+
],
211+
'allowExtraFields' => true,
212+
'extraFieldsMessage' => 'foo bar baz',
213+
]);
214+
215+
$this->assertArrayHasKey('foo', $constraint->fields);
216+
$this->assertInstanceOf(Required::class, $constraint->fields['foo']);
173217
$this->assertTrue($constraint->allowExtraFields);
174218
$this->assertSame('foo bar baz', $constraint->extraFieldsMessage);
175219
}

0 commit comments

Comments
 (0)