Skip to content

Commit 9556299

Browse files
Merge remote-tracking branch '39535/issues/39513_fix-admin-grid-filter-backslash-escaping-issue' into comprs_jul
2 parents b43855f + 2ce2683 commit 9556299

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

app/code/Magento/Ui/Component/Filters/Type/Input.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Ui\Component\Filters\Type;
77

@@ -74,7 +74,7 @@ protected function applyFilter(): void
7474
$valueExpression = $filterConfig['valueExpression'] ?? null;
7575
}
7676
if ($conditionType === self::CONDITION_LIKE) {
77-
$value = str_replace(['%', '_'], ['\%', '\_'], $value);
77+
$value = str_replace(['\\', '%', '_'], ['\\\\', '\%', '\_'], $value);
7878
$valueExpression = $valueExpression ?? '%%%s%%';
7979
}
8080
if ($valueExpression) {

app/code/Magento/Ui/Test/Unit/Component/Filters/Type/InputTest.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -172,7 +172,10 @@ public function testPrepare(array $data, array $filterData, ?array $expectedCond
172172
}
173173

174174
/**
175+
* SuppressWarnings was added due to the big size of data provider
176+
*
175177
* @return array
178+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
176179
*/
177180
public static function getPrepareDataProvider(): array
178181
{
@@ -221,6 +224,16 @@ public static function getPrepareDataProvider(): array
221224
'setValue' => '%\%%',
222225
],
223226
],
227+
[
228+
[
229+
'name' => 'test_date',
230+
],
231+
['test_date' => 'some\\value'],
232+
[
233+
'setConditionType' => 'like',
234+
'setValue' => '%some\\\\value%',
235+
],
236+
],
224237
[
225238
[
226239
'name' => 'text_attr',

0 commit comments

Comments
 (0)