[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 14:09:32 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:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 When wp_die() runs, it checks to see if a more specific die handler should
 be run.

 When checking if the XML die handler should run, it calls is_feed(),
 is_comment_feed(), and is_trackback(). If wp_die() was triggered outside
 of the loop and WP_DEBUG is enabled, these calls will generate
 "doing_it_wrong" error notices.

 In other WordPress functions, such as
 wp_finalize_scraping_edited_file_errors(), WordPress relies on the PHP
 function, error_get_last() to determine if a fatal error has occurred.
 Generally if wp_die() has been triggered by an error, the last error will
 be the one that triggered it.

 However, if a doing_it_wrong notice has been triggered it will take the
 place of the fatal error.

 The net effect is that if WP_DEBUG is enabled, certain protections like
 the plugin editor rollback feature will not function, because the
 doing_it_wrong notice hides the fatal error from WordPress.

 Expected: wp_die() will not trigger any new errors or notices that may
 obscure an error that caused wp_die() to run.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46813>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list