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

Error handler chain #938

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

kagg-design
Copy link

Description

This PR correctly supports the PHP error handler chain.

When the previous error handler is not null, the QM error handler should call it accordingly to make the chain work. In my plugin KAGG Compatibility, the PHP error handler is set in the mu-plugin created at the plugin activation. Even though QM is loaded as the first plugin, the previous handler already exists.

I implemented a similar error handler in the WPForms Development plugin and, partially, in the WPForms plugin. In the presence of QM, I am setting my error handler again on the plugin_loaded hook and making the QM error handler work as a fallback.

An error handler in the mu-plugin aimed to suppress annoying deprecated errors by PHP 8.0+ in different plugins or libraries. Letting the previous handler do its work and showing only meaningful errors in the QM would be good.

Testing steps

  1. Use PHP 8.4.
  2. Activate QM from develop.
  3. Install and activate Elementor.
  4. See a bunch of deprecated errors in the QM console.
  5. Install and activate the KAGG Compatibility plugin (can be found on wp.org).
  6. Check that kagg-compatibility-error-handler.php is added to the mu-plugins folder.
  7. See that Elementor errors are gone from the QM console. This is due to the second error handler added after QM loading.
  8. In the kagg-compatibility-error-handler.php comment out the line add_action( 'plugin_loaded', [ $this, 'plugin_loaded' ], 500 ).
  9. See that Elementor deprecated errors create significant noise in the QM console again.
  10. Switch to the current branch.
  11. See that Elementor deprecated errors are gone.

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