[wp-trac] [WordPress Trac] #31190: esc_html() ate my ampersand

WordPress Trac noreply at wordpress.org
Sat Jan 31 18:37:44 UTC 2015


#31190: esc_html() ate my ampersand
--------------------------+----------------------
 Reporter:  mdgl          |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Formatting    |     Version:  4.1
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by DrewAPicture):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 I would consider this expected behavior for `esc_html()`.

 `–` on input would not be equal to `–` on output simply
 because the ampersand in this instance would (and should) be interpreted
 as a literal string `&`. It's basically double-encoded, and
 `esc_html()` is not really meant to decode special characters in this way.

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


More information about the wp-trac mailing list