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

Repair return type inconsistency in recovery token trait #287

Merged
merged 1 commit into from
Apr 13, 2023

Conversation

MKodde
Copy link
Member

@MKodde MKodde commented Apr 11, 2023

The handleSmsChallenge can return a Response when the OTP challenge request limit is reached. Before this fix, the trait would return an array response. Resulting in this error in the logs:

php.CRITICAL: Uncaught Error: Return value of Surfnet\StepupSelfService\SelfServiceBundle\Controller\SelfAssertedTokensController::handleSmsChallenge() must be an instance of Symfony\Component\HttpFoundation\Response, array returned {"exception":"[object] (TypeError(code: 0): Return value of Surfnet\\StepupSelfService\\SelfServiceBundle\\Controller\\SelfAssertedTokensController::handleSmsChallenge() must be an instance of Symfony\\Component\\HttpFoundation\\Response, array returned at /src/Stepup-SelfService/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/RecoveryTokenControllerTrait.php:76)

To fix that issue, the array return statement is updated to also return a Response object. Simply using the Twig Template that was requested for this response.

No formal bug ticket was created for this bug

The handleSmsChallenge can return a Response when the OTP challenge
request limit is reached. Before this fix, the trait would return an
array response. Resulting in this error in the logs:

`php.CRITICAL: Uncaught Error: Return value of Surfnet\StepupSelfService\SelfServiceBundle\Controller\SelfAssertedTokensController::handleSmsChallenge() must be an instance of Symfony\Component\HttpFoundation\Response, array returned {"exception":"[object] (TypeError(code: 0): Return value of Surfnet\\StepupSelfService\\SelfServiceBundle\\Controller\\SelfAssertedTokensController::handleSmsChallenge() must be an instance of Symfony\\Component\\HttpFoundation\\Response, array returned at /src/Stepup-SelfService/src/Surfnet/StepupSelfService/SelfServiceBundle/Controller/RecoveryTokenControllerTrait.php:76)`

To fix that issue, the array return statement is updated to also return
a Response object. Simply using the Twig Template that was requested for
this response.

No formal bug ticket was created for this bug
@MKodde MKodde requested a review from Shaky212 April 11, 2023 10:01
Copy link

@Shaky212 Shaky212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@MKodde MKodde merged commit ba1a3fb into develop Apr 13, 2023
@MKodde MKodde deleted the bugfix/sms-trait-return-type-incompatibility branch April 13, 2023 10:10
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

Successfully merging this pull request may close these issues.

None yet

2 participants