Skip to content

200 Response Code When Exception is Thrown During Bootstrap #22196

Closed
@c-doug

Description

@c-doug

Preconditions (*)

  1. Version 2.4-develop
  2. PHP 7.2

Steps to reproduce (*)

  1. Force any exception to be thrown during the bootstrapping process so that Magento\Framework\App\Bootstrap calls its terminate() function.

For example:
In \Magento\Catalog\Controller\Category\View::__construct
add new line:
throw new \Throwable('New exception');

  1. Send GET request to http://{base_url}/catalog/category/view/id/1

Expected result (*)

  1. An error message is displayed and a non 200 response code is returned.

Actual result (*)

  1. An error message is displayed and the http response code is 200 OK.

By changing the response code to a 500 before calling exit(1), any monitoring software observing for non-200 response codes will be able to issue an alert when a bootstrap is failing.

Metadata

Metadata

Labels

Component: Framework/AppIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions