[wp-trac] [WordPress Trac] #46813: wp_die() may generate doing_it_wrong notices, confusing other WP error handling
WordPress Trac
noreply at wordpress.org
Fri Apr 5 16:30:44 UTC 2019
#46813: wp_die() may generate doing_it_wrong notices, confusing other WP error
handling
----------------------------+---------------------
Reporter: ohiosierra | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 5.2
Component: Bootstrap/Load | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+---------------------
Changes (by tmdesigned):
* keywords: => has-patch
Comment:
(I am the bug reporter; @ohiosierra is an older handle of mine).
This issue came up with troubleshooting why #46045 wasn't behaving the
same way for me, and as it turns out WP_DEBUG was causing the behavior
noted here. That ticket now has a patch that skirts this issue, but I
still believe it is better for wp_die() to avoid creating additional
warnings / notices.
I've submitted a patch that performs the same check the query functions
perform (i.e. is_feed) to determine if it is a _doing_it_wrong condition.
Performing the check here (silently) prevents the additional notice being
thrown.
The conditional has gotten a little long and could be grouped, but I kept
the isset( $wp_query ) checks on each line for readability.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/46813#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list