Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef10cac

Browse files
[HttpFoundation] Deprecate not passing aClosure together withFILTER_CALLBACK toParameterBag::filter()
1 parentabcc0b8 commitef10cac

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

‎UPGRADE-5.2.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Form
3939
$builder->setDataMapper(new DataMapper(new PropertyPathAccessor()));
4040
```
4141

42+
HttpFoundation
43+
--------------
44+
45+
* Deprecated not passing a`Closure` together with`FILTER_CALLBACK` to`ParameterBag::filter()`; wrap your filter in a closure instead.
46+
4247
Lock
4348
----
4449

‎UPGRADE-6.0.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ HttpFoundation
6666
* Removed`Response::create()`,`JsonResponse::create()`,
6767
`RedirectResponse::create()`, and`StreamedResponse::create()` methods (use
6868
`__construct()` instead)
69+
* Not passing a`Closure` together with`FILTER_CALLBACK` to`ParameterBag::filter()` throws an`InvalidArgumentException`; wrap your filter in a closure instead.
6970

7071
HttpKernel
7172
----------

‎src/Symfony/Component/HttpFoundation/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
* added ability to use comma separated ip addresses for`RequestMatcher::matchIps()`
1111
* added`Request::toArray()` to parse a JSON request body to an array
1212
* added`RateLimiter\RequestRateLimiterInterface` and`RateLimiter\AbstractRequestRateLimiter`
13+
* deprecated not passing a`Closure` together with`FILTER_CALLBACK` to`ParameterBag::filter()`; wrap your filter in a closure instead.
1314

1415
5.1.0
1516
-----

‎src/Symfony/Component/HttpFoundation/InputBag.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ public function filter(string $key, $default = null, int $filter = \FILTER_DEFAU
103103
}
104104
}
105105

106+
if ((\FILTER_CALLBACK &$filter) && !(($options['options'] ??null)instanceof \Closure)) {
107+
trigger_deprecation('symfony/http-foundation','5.2','Not passing a Closure together with FILTER_CALLBACK to "%s()" is deprecated. Wrap your filter in a closure instead.',__METHOD__);
108+
// throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null)));
109+
}
110+
106111
returnfilter_var($value,$filter,$options);
107112
}
108113
}

‎src/Symfony/Component/HttpFoundation/ParameterBag.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ public function filter(string $key, $default = null, int $filter = \FILTER_DEFAU
194194
$options['flags'] = \FILTER_REQUIRE_ARRAY;
195195
}
196196

197+
if ((\FILTER_CALLBACK &$filter) && !(($options['options'] ??null)instanceof \Closure)) {
198+
trigger_deprecation('symfony/http-foundation','5.2','Not passing a Closure together with FILTER_CALLBACK to "%s()" is deprecated. Wrap your filter in a closure instead.',__METHOD__);
199+
// throw new \InvalidArgumentException(sprintf('A Closure must be passed to "%s()" when FILTER_CALLBACK is used, "%s" given.', __METHOD__, get_debug_type($options['options'] ?? null)));
200+
}
201+
197202
returnfilter_var($value,$filter,$options);
198203
}
199204

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp