Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding JWS Fails when Payload is Empty #1199

Open
emil-1996 opened this issue Feb 1, 2024 · 0 comments
Open

Decoding JWS Fails when Payload is Empty #1199

emil-1996 opened this issue Feb 1, 2024 · 0 comments

Comments

@emil-1996
Copy link

Bug Summary:
When attempting to decode a JSON Web Signature (JWS) using the load method from JWSProviderInterface, the decoding process fails if the JWS payload is empty. This behavior is unexpected and leads to issues in scenarios where an empty payload is a valid use case.

Steps to Reproduce:

Utilize the provided code snippet with a JWS having an empty payload.
Observe that the decoding process fails, and the payload remains empty.
Expected Behavior:
The load method should successfully decode the JWS, even when the payload is empty. The resulting $jws variable should contain the decoded information.

 public function index(JWSProviderInterface $JWSProvider): Response
    {
        try {
            $jws = $JWSProvider->load('eyJraWQiOiJhdXRlbnRpLXByb2R1Y3Rpb24tMjAyMTAxMDEiLCJhbGciOiJSUzI1NiJ9..pD458pAX7r4xTfhuoU-jpFAV7mswnWvFGCIwjHt_AK5VsFfmaHi-iz682BD0CzuEW88ENGg4__Q_ZN_91okH499PXIWXch98t0MZcjAEjlyrkVLahZJIRHb-MdflJwVW9iQHpPSYeW3X2u6jVJE9lHJJA6TsQUuDvkgDAd1_BKTcFJKjvgAt-EnFbgwccEjdn2XVefer7bS6aYHb2U8t0P-ySAi0qBkFf8iE_63YkHsQogneJrYaC5NocPTUYHdXodAfYiu6nKOTHqyLxu5gQirSLHJaVxGj2bD3MT10HyYF1sT6ZRg9zFPKIIQIiZu_qN8ZwHQXkuAxRSclRjNr-g');
        } catch (\Exception $e) {
            dd($e->getMessage());
        }
    }

"Error while decoding from JSON"

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant