File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -2810,10 +2810,30 @@ argument of :method:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`::
28102810
28112811 The feature to add an expiration date for a signed URI was introduced in Symfony 7.1.
28122812
2813+ If you need to know the reason why a signed URI is invalid, you can use the
2814+ ``verify() `` method which throws exceptions on failure::
2815+
2816+ use Symfony\Component\HttpFoundation\Exception\ExpiredSignedUriException;
2817+ use Symfony\Component\HttpFoundation\Exception\UnsignedUriException;
2818+ use Symfony\Component\HttpFoundation\Exception\UnverifiedSignedUriException;
2819+
2820+ // ...
2821+
2822+ try {
2823+ $uriSigner->verify($uri); // $uri can be a string or Request object
2824+
2825+ // the URI is valid
2826+ } catch (UnsignedUriException) {
2827+ // the URI isn't signed
2828+ } catch (UnverifiedSignedUriException) {
2829+ // the URI is signed but the signature is invalid
2830+ } catch (ExpiredSignedUriException) {
2831+ // the URI is signed but expired
2832+ }
2833+
28132834.. versionadded :: 7.3
28142835
2815- Starting with Symfony 7.3, signed URI hashes no longer include the ``/ `` or
2816- ``+ `` characters, as these may cause issues with certain clients.
2836+ The ``verify() `` method was introduced in Symfony 7.3.
28172837
28182838Troubleshooting
28192839---------------
You can’t perform that action at this time.
0 commit comments