Skip to content

Commit b829a1c

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

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Http/RequestMatcher/UnsafeRequestMatcher.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@
1313

1414
use Symfony\Component\HttpFoundation\Request;
1515
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
16+
use Symfony\Component\HttpKernel\Kernel;
1617

1718
class UnsafeRequestMatcher implements RequestMatcherInterface
1819
{
1920
public function matches(Request $request)
2021
{
21-
return !$request->isMethodSafe(false);
22+
// hack needed for compatibility with SF 3.4 => 4.3
23+
// sf 3.4 => isMethodSafe(false)
24+
// sf 4.3 => isMethodSafe() or isMethodSafe(false)
25+
// sf 4.4 => isMethodSafe()
26+
if (Kernel::VERSION_ID >= 40300) {
27+
return !$request->isMethodSafe();
28+
} else {
29+
return !$request->isMethodSafe(false);
30+
}
2231
}
2332
}

0 commit comments

Comments
 (0)