Skip to content

Commit fb7cc99

Browse files
committed
Fix getString() method not available on older Symfony versions
1 parent 6a0c9c2 commit fb7cc99

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Controller/NotifyController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class NotifyController extends PayumController
99
{
1010
public function doUnsafeAction(Request $request): Response
1111
{
12-
$gateway = $this->getPayum()->getGateway($request->attributes->getString('gateway'));
12+
$gateway = $this->getPayum()->getGateway($request->attributes->get('gateway'));
1313

1414
$gateway->execute(new Notify(null));
1515

Security/HttpRequestVerifier.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ public function verify($httpRequest)
3636
));
3737
}
3838

39-
if (! $hash = $httpRequest->attributes->getString('payum_token', $httpRequest->query->getString('payum_token', $httpRequest->request->getString('payum_token')))) {
39+
// Use get() for Symfony 5.4+ compatibility (getString() was added in 6.3)
40+
$hash = $httpRequest->attributes->get('payum_token')
41+
?? $httpRequest->query->get('payum_token')
42+
?? $httpRequest->request->get('payum_token');
43+
44+
if (! $hash) {
4045
throw new NotFoundHttpException('Token parameter not set in request');
4146
}
4247

0 commit comments

Comments
 (0)