Decoding JWS Fails when Payload is Empty
emil-1996 opened this issue · 0 comments
emil-1996 commented
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"