Skip to content

Commit 458a367

Browse files
committed
Fix deprecation with isMethodSafe
1 parent 2be2458 commit 458a367

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Http/RequestMatcher/UnsafeRequestMatcher.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ class UnsafeRequestMatcher implements RequestMatcherInterface
1818
{
1919
public function matches(Request $request)
2020
{
21-
return !$request->isMethodSafe(false);
21+
// hack needed for compatibility with SF 3.4 => 4.3
22+
// sf 3.4 => isMethodSafe(false)
23+
// sf 4.3 => isMethodSafe() or isMethodSafe(false)
24+
// sf 4.4 => isMethodSafe()
25+
if (method_exists($request, 'getPreferredFormat')) {
26+
return !$request->isMethodSafe();
27+
} else {
28+
return !$request->isMethodSafe(false);
29+
}
2230
}
2331
}

0 commit comments

Comments
 (0)