[wp-trac] [WordPress Trac] #2691: HTML comments in posts aren't handled properly.

WordPress Trac noreply at wordpress.org
Thu Jul 4 03:51:54 UTC 2019


#2691: HTML comments in posts aren't handled properly.
-------------------------------------------------+-------------------------
 Reporter:  gord                                 |       Owner:
                                                 |  adamsilverstein
     Type:  defect (bug)                         |      Status:  accepted
 Priority:  normal                               |   Milestone:  5.3
Component:  Formatting                           |     Version:  2.8.5
 Severity:  normal                               |  Resolution:
 Keywords:  wpautop dev-feedback has-patch has-  |     Focuses:
  unit-tests                                     |
-------------------------------------------------+-------------------------
Changes (by pento):

 * keywords:  wpautop dev-feedback has-patch has-unit-tests commit =>
     wpautop dev-feedback has-patch has-unit-tests


Comment:

 Nice work on the patch, @adamsilverstein!

 Is there any reason it's checking for `<!-` and `->`, instead of `<!--`
 and `-->`? This seems to cause issues sometimes. For example, adding this
 test to `data_html_comments` fails:

 {{{#!php
 array(
         "foo\n\n<!-- HTML comment ->\n\n still in the comment... -->",
         "<p>foo</p>\n<!-- HTML comment ->\n\n still in the comment...
 -->",
 ),
 }}}

 Also, can you explain the `if` on line 607 of `formatting.php`? It seems
 like it will only remove the trailing `</p>` if the entire content starts
 with `<!-`, rather than if the paragraph starts with it, as the comment
 suggests.

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


More information about the wp-trac mailing list