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

Ensure __toString() catches all error types #21545

Merged
merged 1 commit into from
Apr 8, 2019
Merged

Ensure __toString() catches all error types #21545

merged 1 commit into from
Apr 8, 2019

Conversation

tylers-username
Copy link

@tylers-username tylers-username commented Mar 1, 2019

Description (*)

In PHP 7.1 catch (\Exception ...) does not catch fatal errors. Because this function can possibly throw fatal errors such as "Call to a member function getRequestFieldName() on null" which is an instance of \Error, we should catch \Throwable to ensure the exception makes it into the logger and $result is assigned the message.

Fixed Issues (if relevant)

  1. Exception message expected to be assigned to a variable is instead handled by PHP's default Fatal Error handler.

Contribution checklist (*)

  • [*] Pull request has a meaningful description of its purpose
  • [*] All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • [*] All automated tests passed successfully (all builds on Travis CI are green)

In PHP 7.1 `catch (\Exception ...)` does not catch fatal errors. Because this function can possibly throw fatal errors such as "`Call to a member function getRequestFieldName() on null`" which is an instance of `\Error`, we should catch `\Throwable` to ensure the exception makes it into the logger and `$result` is assigned the message.
@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Mar 1, 2019

CLA assistant check
All committers have signed the CLA.

@magento-engcom-team
Copy link
Contributor

Hi @tylerssn. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@ghost ghost assigned rogyar Mar 2, 2019
@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-4423 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@tylerssn thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@tylers-username
Copy link
Author

tylers-username commented Mar 2, 2019

Done, @magento-engcom-team. Thank you.

@soleksii
Copy link

✔️ QA Passed

@m2-assistant
Copy link

m2-assistant bot commented Apr 8, 2019

Hi @tylerssn, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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

Successfully merging this pull request may close these issues.

6 participants