[wp-trac] [WordPress Trac] #47580: Prevent output of invalid HTML in `_default_wp_die_handler()`

WordPress Trac noreply at wordpress.org
Thu Jun 20 14:34:38 UTC 2019


#47580: Prevent output of invalid HTML in `_default_wp_die_handler()`
---------------------------+-----------------------------
 Reporter:  jeremyfelt     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:
 Severity:  normal         |   Keywords:  needs-patch
  Focuses:  accessibility  |
---------------------------+-----------------------------
 The default handler for `wp_die()` wraps (by default) error messages with
 a paragraph tag.

 For a large number of `wp_die()` calls in WordPress, a plain text string
 is passed and the HTML displayed is valid: `<p>This is an error
 message.</p>`.

 Also for a large number of `wp_die()` calls in WordPress, an HTML string
 is passed and the HTML displayed is invalid: `<p><h1>You need a higher
 level of permission.</h1><p>Sorry, you are not allowed to manage terms in
 this taxonomy.</p></p>`

 It seems that both use cases are valid and should be supported. `wp_die()`
 already has `$args` that are passed to the handlers. It seems like we
 could add key there for whether the handler should wrap in its own HTML or
 display the message as is.

 Supporting a new argument would make it possible to have a slightly more
 complex error message while also maintaining the simple output of general
 error messages.

 Related #47413, which addresses the issue when filling out a comment.

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


More information about the wp-trac mailing list