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

WordPress Trac noreply at wordpress.org
Tue Aug 13 17:47:15 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:  5.3
Component:  Administration          |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:  accessibility
------------------------------------+----------------------------
Changes (by dinhtungdu):

 * keywords:  needs-patch => has-patch dev-feedback


Comment:

 After considering checking for tags in the `$message` and replacing `p` by
 `div`, I think it's better to use `div` for the die message wrapper.

 We can check if `$message` contains `<p>`, but it means that we need to
 check for other tags as well. `h1` for example, can't be a child element
 of `p`. A full covered check can make the current function more complex.

 On the other hand, replacing `p` by `div` doesn't increase the complexity
 of `_default_wp_die_handler`.

 What I did:
 * Use `div` as `$message` wrapper in the function
 `_default_wp_die_handler`. The error message now is always wrapped by `div
 .wp-die-message`.
 * Update CSS rules in `common.css` and internal CSS for error page to keep
 the current die message unchanged in term of visual.
 * Update this to match with the new wrapper:
 https://core.trac.wordpress.org/browser/trunk/src/index.php?rev=45649&marks=33-55#L32

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


More information about the wp-trac mailing list