Incorrect use of RedirectResponse throws 500 error

Created on 9 July 2024, 6 months ago
Updated 10 July 2024, 6 months ago

There is wrong code in:
src/Controller/LTIToolProviderV1P3Launch.php
modules/lti_tool_provider_content/src/Controller/LTIToolProviderContentLaunch.php

code such as: "return new RedirectResponse('/', 500);"
Is erroneous and will not work. 500 is not a valid redirect code, and you will get a 500 error because of this code (not the response desired).
RedirectResponse can take other codes, such as 302.

I do not know if this is the kind of behavior desired, but one could replace these with:
- return new RedirectResponse('/', 500);
+ $accessDeniedUrl = Url::fromRoute('system.403')->toString();
+ return new RedirectResponse($accessDeniedUrl, 302);

If a 500 response is necessary, I think you may need to issue http_response_code(500);, then print something to the screen, and exit.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇺🇸United States bob.hinrichs

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024