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

Fix issue where exceptions triggered by extensions could be silently swallowed #232

Merged
merged 1 commit into from
May 11, 2021

Conversation

kinglozzer
Copy link
Member

Something I overlooked in #229. Logging::getLogger() uses the default logging service, SilverStripe\Omnipay\Logger. If that has been set to a NullLogger as per the instructions in added #229, then exceptions thrown during safeExtend() can be swallowed in live mode.

This change ensures that if a separate logger is set up for fatal errors (as described in #229), it will be used by safeExtend() and safeguard() so that exceptions can still be logged. As per the other pull request, if no separate Injector service has been set up for SilverStripe\Omnipay\ExceptionLogger then it inherits from SilverStripe\Omnipay\Logger instead:

SilverStripe\Omnipay\ExceptionLogger: '%$SilverStripe\Omnipay\Logger'

I’ve pushed a 3.1 branch for this, so it can be tagged as 3.1.2 without including the other changes that are currently in master.

@kinglozzer
Copy link
Member Author

Will self-merge this soon if no one objects. Out of the box things should be fine, but it’s a potentially nasty bug if someone has opted into this behaviour https://github.com/silverstripe/silverstripe-omnipay/blob/master/docs/en/Logging.md#disable-non-fatal-error-logging as it could mean that fatal errors during onPaymentComplete() handlers may not be logged

@kinglozzer kinglozzer merged commit 7209d5c into silverstripe:3.1 May 11, 2021
@kinglozzer kinglozzer deleted the silent-exceptions branch May 11, 2021 11:36
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.

1 participant