Skip to content

Commit 733dec5

Browse files
authored
Fix incompatibility with laminas-escaper (2.7.1)
Apply suggestions from code review
1 parent 9f2af73 commit 733dec5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

lib/internal/Magento/Framework/Escaper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ public function escapeUrl($string)
289289
* @return string
290290
* @since 101.0.0
291291
*/
292-
public function encodeUrlParam(string $string)
292+
public function encodeUrlParam($string)
293293
{
294-
return $this->getEscaper()->escapeUrl($string);
294+
return $this->getEscaper()->escapeUrl((string)$string);
295295
}
296296

297297
/**
@@ -328,9 +328,9 @@ function ($matches) {
328328
* @return string
329329
* @since 101.0.0
330330
*/
331-
public function escapeCss(string $string)
331+
public function escapeCss($string)
332332
{
333-
return $this->getEscaper()->escapeCss($string);
333+
return $this->getEscaper()->escapeCss((string)$string);
334334
}
335335

336336
/**

lib/internal/Magento/Framework/Test/Unit/EscaperTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ public function testEscapeCss($data, string $expected): void
384384
public function escapeCssDataProvider(): array
385385
{
386386
return [
387+
[
388+
'data' => 1,
389+
'expected' => '1',
390+
],
387391
[
388392
'data' => '*%string{foo}%::',
389393
'expected' => '\2A \25 string\7B foo\7D \25 \3A \3A ',
@@ -418,6 +422,14 @@ public function encodeUrlParamDataProvider(): array
418422
[
419423
'data' => "example string",
420424
'expected' => "example%20string",
425+
],
426+
[
427+
'data' => 1,
428+
'expected' => "1",
429+
],
430+
[
431+
'data' => null,
432+
'expected' => "",
421433
]
422434
];
423435
}

0 commit comments

Comments
 (0)