-
Notifications
You must be signed in to change notification settings - Fork 50
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
Spatie Ignition for Debugging #256
Conversation
572ba89
to
2b85d73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this! I left my thoughts/questions in some comments but not blocking from moving forward
mu-plugins/wp-ignition/composer.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: why not include this is a dev dependency in the root composer.json so it's one less composer.json file. When running --production it won't be loaded and then the plugin code would never run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played with that idea a bunch. Unfortunately we'd need to load our autoloader in WP-config.php or something, otherwise it doesn't load early enough.
Our current MU plugin loads the autoloader late in the WP boot process and we want it to load as the first plugin, to ensure all errors are handled by Ignition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think wp-config.php is the best place to load this to be honest. The repo could have a wp-config-sample.php
Description of the Change
This PR adds a new plugin to the scaffold. The plugin adds
spatie/ignition
as a debugging tool. Ignition is the default error page for Laravel Projects, and for good reason. It includes great stack traces as well as other helpful information that can be used to debug the issue. There's an example of an issue page below:It lets engineers quickly jump to the problem code, reducing debugging time (see video below).
Tower.-.wp-scaffold.2024-11-28.at.12.33.01.PM.1.mp4
We load it using the
000-wp-ignition-loader.php
file as it needs to run as soon as possible in order to catch errors in MU plugins.Whilst this should be ignored from deployments to production environments, since we should be handling errors transparently there, it does have some protections in place to ensure it doesn't run, as long as the
wp_get_environment_type()
returns correctly.Note
This update doesn't handle Fatal Errors, like Abstract Class extension issues because they happen at compile-time and therefore are handled by PHP's and WordPress's
register_shutdown_function()
before this package has time to process them.How to test the Change
Clone locally. Change something in the plugins/theme to cause a PHP error. See Ignition.
Changelog Entry
Credits
Props @darylldoyle
Checklist:
I have updated the documentation accordingly.I have added Critical Flows, Test Cases, and/or End-to-End Tests to cover my change.