Skip to content

Commit 9bd2814

Browse files
committed
Merge branch '5.4' into 6.3
* 5.4: Fix bad merge CS fix [ErrorHandler] Don't format binary strings [Validator] Consistently use "This value is not" instead of "This is not" in error messages [Messenger] Improve Redis integration tests [Validator] added missing Estonian and Romanian translations
2 parents 512f8c4 + a8dce3f commit 9bd2814

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+389
-344
lines changed

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ public function formatArgs(array $args): string
9191
$formattedValue = '<em>'.strtolower(htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset)).'</em>';
9292
} elseif ('resource' === $item[0]) {
9393
$formattedValue = '<em>resource</em>';
94+
} elseif (preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
95+
$formattedValue = '<em>binary string</em>';
9496
} else {
9597
$formattedValue = str_replace("\n", '', htmlspecialchars(var_export($item[1], true), \ENT_COMPAT | \ENT_SUBSTITUTE, $this->charset));
9698
}

src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ private function formatArgs(array $args): string
171171
$formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
172172
} elseif ('resource' === $item[0]) {
173173
$formattedValue = '<em>resource</em>';
174+
} elseif (preg_match('/[^\x07-\x0D\x1B\x20-\xFF]/', $item[1])) {
175+
$formattedValue = '<em>binary string</em>';
174176
} else {
175177
$formattedValue = str_replace("\n", '', $this->escape(var_export($item[1], true)));
176178
}

src/Symfony/Component/ErrorHandler/Tests/ErrorRenderer/HtmlErrorRendererTest.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,45 @@ public static function getRenderData(): iterable
5454
$expectedNonDebug,
5555
];
5656
}
57+
58+
public function testRendersStackWithoutBinaryStrings()
59+
{
60+
if (\PHP_VERSION_ID >= 70400) {
61+
// make sure method arguments are available in stack traces (see https://www.php.net/manual/en/ini.core.php)
62+
ini_set('zend.exception_ignore_args', false);
63+
}
64+
65+
$binaryData = file_get_contents(__DIR__.'/../Fixtures/pixel.png');
66+
$exception = $this->getRuntimeException($binaryData);
67+
68+
$rendered = (new HtmlErrorRenderer(true))->render($exception)->getAsString();
69+
70+
$this->assertStringContainsString(
71+
"buildRuntimeException('FooException')",
72+
$rendered,
73+
'->render() contains the method call with "FooException"'
74+
);
75+
76+
$this->assertStringContainsString(
77+
'getRuntimeException(binary string)',
78+
$rendered,
79+
'->render() contains the method call with "binary string" replacement'
80+
);
81+
82+
$this->assertStringContainsString(
83+
'<em>binary string</em>',
84+
$rendered,
85+
'->render() returns the HTML content with "binary string" replacement'
86+
);
87+
}
88+
89+
private function getRuntimeException(string $unusedArgument): \RuntimeException
90+
{
91+
return $this->buildRuntimeException('FooException');
92+
}
93+
94+
private function buildRuntimeException(string $message): \RuntimeException
95+
{
96+
return new \RuntimeException($message);
97+
}
5798
}
69 Bytes
Loading

src/Symfony/Component/Messenger/Bridge/Redis/Tests/Transport/RedisExtIntegrationTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function testLazy()
275275
], $message['data']);
276276
$connection->reject($message['id']);
277277
} finally {
278-
$redis->del('messenger-lazy');
278+
$redis->unlink('messenger-lazy');
279279
}
280280
}
281281

@@ -311,7 +311,7 @@ public function testJsonError()
311311
} catch (TransportException $e) {
312312
$this->assertSame('Malformed UTF-8 characters, possibly incorrectly encoded', $e->getMessage());
313313
} finally {
314-
$redis->del('messenger-json-error');
314+
$redis->unlink('messenger-json-error');
315315
}
316316
}
317317

@@ -327,7 +327,7 @@ public function testGetNonBlocking()
327327
$this->assertNotEmpty($message = $connection->get());
328328
$connection->reject($message['id']);
329329
} finally {
330-
$redis->del('messenger-getnonblocking');
330+
$redis->unlink('messenger-getnonblocking');
331331
}
332332
}
333333

@@ -346,7 +346,7 @@ public function testGetAfterReject()
346346
$connection = Connection::fromDsn('redis://localhost/messenger-rejectthenget', ['sentinel_master' => null]);
347347
$this->assertNotNull($connection->get());
348348
} finally {
349-
$redis->del('messenger-rejectthenget');
349+
$redis->unlink('messenger-rejectthenget');
350350
}
351351
}
352352

src/Symfony/Component/Validator/Resources/translations/validators.af.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">
138138
<source>This is not a valid IP address.</source>
139-
<target>Hierdie is nie 'n geldige IP-adres nie.</target>
139+
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige IP-adres nie.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59">
226226
<source>This is not a valid International Bank Account Number (IBAN).</source>
227-
<target>Hierdie is nie 'n geldige Internationale Bank Rekening Nommer (IBAN) nie.</target>
227+
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige Internasionale Bankrekeningnommer (IBAN) nie.</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">
314314
<source>This is not a valid Business Identifier Code (BIC).</source>
315-
<target>Hierdie is nie 'n geldige Besigheids Identifikasie Kode (BIC) nie.</target>
315+
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige Besigheid Identifiseerder Kode (BIC) nie.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Fout</target>
320320
</trans-unit>
321321
<trans-unit id="83">
322322
<source>This is not a valid UUID.</source>
323-
<target>Hierdie is nie 'n geldige UUID nie.</target>
323+
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige UUID nie.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -435,8 +435,8 @@
435435
<target state="needs-review-translation">Die opgespoorde karakterkodering is ongeldig ({{ detected }}). Toegelate koderings is {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438-
<source>This is not a valid MAC address.</source>
439-
<target state="needs-review-translation">Dit is nie 'n geldige MAC-adres nie.</target>
438+
<source>This value is not a valid MAC address.</source>
439+
<target state="needs-review-translation">Hierdie waarde is nie 'n geldige MAC-adres nie.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

src/Symfony/Component/Validator/Resources/translations/validators.ar.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">
138138
<source>This is not a valid IP address.</source>
139-
<target>هذه القيمة ليست عنوان رقمى صحيح.</target>
139+
<target state="needs-review-translation">هذه القيمة ليست عنوان IP صالحًا.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59">
226226
<source>This is not a valid International Bank Account Number (IBAN).</source>
227-
<target>الرقم IBAN (رقم الحساب المصرفي الدولي) الذي تم إدخاله غير صالح.</target>
227+
<target state="needs-review-translation">هذه القيمة ليست رقم حساب بنكي دولي (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">
314314
<source>This is not a valid Business Identifier Code (BIC).</source>
315-
<target>هذه القيمة ليست رمز معرّف نشاط تجاري صالح (BIC).</target>
315+
<target state="needs-review-translation">هذه القيمة ليست رمز معرف الأعمال (BIC) صالحًا.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>خطأ</target>
320320
</trans-unit>
321321
<trans-unit id="83">
322322
<source>This is not a valid UUID.</source>
323-
<target>هذا ليس UUID صالح.</target>
323+
<target state="needs-review-translation">هذه القيمة ليست UUID صالحًا.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -435,8 +435,8 @@
435435
<target state="needs-review-translation">تم اكتشاف ترميز الأحرف غير صالح ({{ detected }}). الترميزات المسموح بها هي {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438-
<source>This is not a valid MAC address.</source>
439-
<target state="needs-review-translation">هذا ليس عنوان MAC صالحًا.</target>
438+
<source>This value is not a valid MAC address.</source>
439+
<target state="needs-review-translation">هذه القيمة ليست عنوان MAC صالحًا.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

src/Symfony/Component/Validator/Resources/translations/validators.az.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">
138138
<source>This is not a valid IP address.</source>
139-
<target>Bu düzgün bir IP adresi deyil.</target>
139+
<target state="needs-review-translation">Bu dəyər etibarlı bir IP ünvanı deyil.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59">
226226
<source>This is not a valid International Bank Account Number (IBAN).</source>
227-
<target>Bu dəyər doğru bir Beynəlxalq Bank Hesap Nömrəsi (IBAN) deyil.</target>
227+
<target state="needs-review-translation">Bu dəyər etibarlı bir Beynəlxalq Bank Hesab Nömrəsi (IBAN) deyil.</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">
314314
<source>This is not a valid Business Identifier Code (BIC).</source>
315-
<target>Bu dəyər doğru bir Biznes Təyinedici Kodu (BIC) deyil.</target>
315+
<target state="needs-review-translation">Bu dəyər etibarlı bir Biznes Təyinat Kodu (BIC) deyil.</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Xəta</target>
320320
</trans-unit>
321321
<trans-unit id="83">
322322
<source>This is not a valid UUID.</source>
323-
<target>Bu dəyər doğru bir UUID deyil.</target>
323+
<target state="needs-review-translation">Bu dəyər etibarlı bir UUID deyil.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -435,8 +435,8 @@
435435
<target>Təsbit edilən simvol şifrləməsi yanlışdır. ({{ detected }}). İcazə verilən şifrləmələr bunlardır: {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438-
<source>This is not a valid MAC address.</source>
439-
<target>Bu MAC ünvanı yanlışdır.</target>
438+
<source>This value is not a valid MAC address.</source>
439+
<target state="needs-review-translation">Bu dəyər etibarlı bir MAC ünvanı deyil.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

src/Symfony/Component/Validator/Resources/translations/validators.be.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">
138138
<source>This is not a valid IP address.</source>
139-
<target>Значэнне не з'яўляецца сапраўдным IP-адрасам.</target>
139+
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным IP-адрасам.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59">
226226
<source>This is not a valid International Bank Account Number (IBAN).</source>
227-
<target>Несапраўдны міжнародны нумар банкаўскага рахунку (IBAN).</target>
227+
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным міжнародным нумарам банкаўскага рахунку (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">
314314
<source>This is not a valid Business Identifier Code (BIC).</source>
315-
<target>Несапраўдны банкаўскі ідэнтыфікацыйны код (BIC).</target>
315+
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным кодам ідэнтыфікацыі бізнесу (BIC).</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Памылка</target>
320320
</trans-unit>
321321
<trans-unit id="83">
322322
<source>This is not a valid UUID.</source>
323-
<target>Гэта несапраўдны UUID.</target>
323+
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным UUID.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -435,8 +435,8 @@
435435
<target state="needs-review-translation">Выяўленая кадыроўка знакаў няслушная ({{ detected }}). Дазволеныя кадыроўкі: {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438-
<source>This is not a valid MAC address.</source>
439-
<target state="needs-review-translation">Гэта не сапраўдны MAC-адрас.</target>
438+
<source>This value is not a valid MAC address.</source>
439+
<target state="needs-review-translation">Гэта значэнне не з'яўляецца сапраўдным MAC-адрасам.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

src/Symfony/Component/Validator/Resources/translations/validators.bg.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">
138138
<source>This is not a valid IP address.</source>
139-
<target>Това не е валиден IP адрес.</target>
139+
<target state="needs-review-translation">Тази стойност не е валиден IP адрес.</target>
140140
</trans-unit>
141141
<trans-unit id="38">
142142
<source>This value is not a valid language.</source>
@@ -224,7 +224,7 @@
224224
</trans-unit>
225225
<trans-unit id="59">
226226
<source>This is not a valid International Bank Account Number (IBAN).</source>
227-
<target>Това не е валиден Международен номер на банкова сметка (IBAN).</target>
227+
<target state="needs-review-translation">Тази стойност не е валиден международен банков сметка номер (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">
314314
<source>This is not a valid Business Identifier Code (BIC).</source>
315-
<target>Това не е валиден Бизнес идентификационен код (BIC).</target>
315+
<target state="needs-review-translation">Тази стойност не е валиден код за идентификация на бизнеса (BIC).</target>
316316
</trans-unit>
317317
<trans-unit id="82">
318318
<source>Error</source>
319319
<target>Грешка</target>
320320
</trans-unit>
321321
<trans-unit id="83">
322322
<source>This is not a valid UUID.</source>
323-
<target>Това не е валиден UUID.</target>
323+
<target state="needs-review-translation">Тази стойност не е валиден UUID.</target>
324324
</trans-unit>
325325
<trans-unit id="84">
326326
<source>This value should be a multiple of {{ compared_value }}.</source>
@@ -435,8 +435,8 @@
435435
<target>Откритото кодиране на знаците е невалидно ({{ detected }}). Разрешените кодирания са {{ encodings }}.</target>
436436
</trans-unit>
437437
<trans-unit id="112">
438-
<source>This is not a valid MAC address.</source>
439-
<target>Невалиден MAC адрес.</target>
438+
<source>This value is not a valid MAC address.</source>
439+
<target state="needs-review-translation">Тази стойност не е валиден MAC адрес.</target>
440440
</trans-unit>
441441
</body>
442442
</file>

0 commit comments

Comments
 (0)