You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 2, 2022. It is now read-only.
Describe the bug
If you modify the array that the get_enqueue_contexts method returns, a new WP_Error object is created and returned when performing the in_array check in several methods. This causes a somewhat cryptic error being thrown as at that point you are attempting to enqueue a script or stylesheet with a WP_Error object as the style/script path string.
Steps to Reproduce
Clone the repo
Run npm run-script start, yarn start, etc.
Remove admin from return [ 'admin', 'frontend', 'shared' ]; on line 86 of core.php
Activate the plugin
Expected behavior
Display a WordPress warning/error on the back-end with the messages passed to the WP_Error constructors.
Screenshots
Catchable fatal error: Object of class WP_Error could not be converted to string in /var/www/html/wp-includes/http.php on line 681
...
The text was updated successfully, but these errors were encountered:
Perhaps I don't have a full grasp of what WP_Error should and should not do here. I made somewhat of an assumption that WP_Error would display the error with the strings passed to it, but that doesn't seem to actually be the case. The class simply wraps the error so you can do something with it later on (which I think ya'll already understand).
I still think that there should be somewhat of a different experience with the way the error is displayed here, but I will leave that up to the plugin authors. I'll leave this open for the time being, as I'd love to hear some feedback on this to maybe help my understanding to the correct way of handling errors in WP.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
If you modify the array that the
get_enqueue_contexts
method returns, a newWP_Error
object is created and returned when performing thein_array
check in several methods. This causes a somewhat cryptic error being thrown as at that point you are attempting to enqueue a script or stylesheet with a WP_Error object as the style/script path string.Steps to Reproduce
npm run-script start
,yarn start
, etc.admin
fromreturn [ 'admin', 'frontend', 'shared' ];
on line86
ofcore.php
Expected behavior
Display a WordPress warning/error on the back-end with the messages passed to the WP_Error constructors.
Screenshots
The text was updated successfully, but these errors were encountered: