WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#27148 new defect (bug)

comments in page code converted to displayed text upon submission

Reported by: wchapin Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.8
Component: Editor Keywords: needs-patch needs-testing
Focuses: Cc:

Description

When editing a WP page in code/text view, comments inserted with "<!-- comment -->" display correctly (not shown) in the visual view, but when posted (submit or preview) get parsed to "&lt;!-- comment --&gt;" and are displayed publicly.

Change History (8)

#1 follow-up: @SergeyBiryukov
4 years ago

  • Component changed from General to Formatting
  • Keywords reporter-feedback added

Could not reproduce with just <!-- comment --> on a clean install (it's not visible on front-end, as expected). Could you provide the actual markup you use to reproduce the issue?

Appears to be a duplicate of #8912.

#2 in reply to: ↑ 1 @wchapin
4 years ago

Replying to SergeyBiryukov:

Could not reproduce with just <!-- comment --> on a clean install (it's not visible on front-end, as expected). Could you provide the actual markup you use to reproduce the issue?

Appears to be a duplicate of #8912.

I have created a new blog: wlcbugs.wordpress.com/about

After creating the blog, I edited the sample "about" page. In edit mode, I changed to "text" view. I appended a list to the default text. Then I commented-out the third item. I switched to "visual" view, and it appeared correct. But after I published, the "<" got changed to "&lt;" and thus it was no longer a comment.

#3 @knutsp
4 years ago

Cannot reproduce, 3.81 or latest alpha. Any html comment element I make stays a html comment no matter what I do, switching between text/visual or publishing/updating.

You still haven't provided the exact html you used. Please do.

The default about page is already published on a new site. What do you mean by publishing? Update?

I have occasionally, now about a year since last time, seen html brackets being converted to &lt; and &gt; during a post update, but I have always blamed a bad plugin or theme. Never managed to track it down, though. No html comment elements have been in use, so it may not have been related to html comments.

#4 @wchapin
4 years ago

First of all, I cannot duplicate the behavior within creating a post, only on editing a page. The HTML comment works as expected within a post.

Second point is that an inline comment outside of other HTML tags works as expected.

When editing a page I entered the following in text view: ====================== <ol>

<li>Point number 1</li> <li>Point number 2</li> <li>Point number 3</li> <li>Point number 4</li> <li>Point number 5</li>

</ol> ====================== I want to comment out one of the list items, but save it to enable it later. So I create the following code: ====================== <ol>

<li>Point number 1</li> <li>Point number 2</li>

<!--

<li>Point number 3</li>

-->

<li>Point number 4</li> <li>Point number 5</li>

</ol> ====================== This evening I get different behavior than this morning. Prior to this evening, when I switched to "visual" view, I got what I expected. However, when I posted, the "<!--" was converted to "&lt;!--" and the "-->" converted to "--&gt;" and all text was presented literally.

Now, when I switch to "visual" view, the code converts to this: ====================== <ol> <ol>

<li>Point number 1</li> <li>Point number 2</li>

</ol> </ol> <!--

<li>Point number 3</li>

--> <ol>

<li>Point number 4</li> <li>Point number 5</li>

</ol> ====================== And the display is what you would expect from that ... two lists of different depths. But this is not what is desired.

If it is posted directly, without switching to visual view first, I get the following: ====================== <ol>

<li>Point number 1</li> <li>Point number 2</li>

&lt;!--

<li>Point number 3</li>

--&gt;

<li>Point number 4</li> <li>Point number 5</li>

</ol> ======================

My test blog is at http://wlcbugs.wordpress.com/about Follow my procedure above in my first comment to edit a page on a WP site.

#5 @knutsp
4 years ago

  • Keywords close added

Still cannot reproduce conversion to &lt;!-- and --&gt; when editing a page, using your code.

I can, however, reproduce the other effects, that switching to visual destroys the structure of a list when the list has a html comment inside it.

Your test blog is hosted at wordpress.com. Any such blog is not a clean installation of WordPress from wordpress.org (without plugins).

And I can reproduce this bug at my wordpress.com test blog. Please try http://en.support.wordpress.com/ for help.

Clearly a duplicate of #8912 for the list issue when inserting html comments.

#6 @wchapin
4 years ago

Thanks for relating the issue to #8912, but the behavior is now different from what was reported then. In #8912, the en-dash is getting converted to "&#8211;". In this report, the angle brackets are getting converted to "&lt;" and "&gt;", respectively.

Thanks for pointing out the bug I am seeing is on wordpress.com, and thus I should be reporting it to Automattic.

#7 @miqrogroove
4 years ago

  • Component changed from Formatting to Editor
  • Keywords reporter-feedback close removed
  • Version set to 3.8

Changing components. It looks like the only confirmed and non-duplicate bug here is this code...

<ol>
<li>Point number 1</li>
<li>Point number 2</li>
<!--
<li>Point number 3</li>
-->
<li>Point number 4</li>
<li>Point number 5</li>
</ol>

... when pasted into the Text tab and then switching to the Visual tab it is not parsed correctly.

#8 @chriscct7
3 years ago

  • Keywords needs-patch needs-testing added
Note: See TracTickets for help on using tickets.