8000 minor #13216 Fixed CSRF check in controller (HeahDude) · symfony/symfony-docs@325c6d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 325c6d7

Browse files
committed
minor #13216 Fixed CSRF check in controller (HeahDude)
This PR was merged into the 3.4 branch. Discussion ---------- Fixed CSRF check in controller Commits ------- ee481e9 Fixed CSRF check in controller
2 parents 3e717fc + ee481e9 commit 325c6d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

controller/csrf_token_validation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ want to use the Symfony Form component. If, for example, you are implementing
99
a DELETE action, you can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::isCsrfTokenValid`
1010
method to check the validity of a CSRF token::
1111

12-
public function deleteAction()
12+
use Symfony\Component\HttpFoundation\Request;
13+
14+
public function deleteAction(Request $request)
1315
{
14-
if ($this->isCsrfTokenValid('token_id', $submittedToken)) {
16+
if ($this->isCsrfTokenValid('token_id', $request->request->get('token_param'))) {
1517
// ... do something, like deleting an object
1618
}
1719
}

0 commit comments

Comments
 (0)
0