WordPress.org

Making WordPress.org

Opened 3 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#4457 closed defect (fixed)

Encoding issue in the Syntax Highlighter Evolved block

Reported by: truongwp Owned by: coffee2code
Milestone: Priority: normal
Component: Handbooks Keywords:
Cc:

Description

See this page: https://developer.wordpress.org/themes/functionality/widgets/#registering-a-widget

Many > characters display as >.

When I view the page source, I see that the > character is encoded 2 times to >

I copied the content from the live site to my local site. This issue does not occur on my local.

I'm trying installing meta-environment to check if there is another plugin/code causes this.

Change History (14)

#1 @nosolosw
3 months ago

  • Type changed from enhancement to defect

There is a maybe related issue in the Block Editor Handbook. See the second example at https://developer.wordpress.org/block-editor/tutorials/javascript/extending-the-block-editor/.

cc @coffee2code

#2 @coffee2code
3 months ago

@nosolosw: I believe the example you cited is a different Syntax Highlighter bug(?) that's causing the code block in question (the 2nd on the page) to subsume all text up to and through the next code block.

It's triggered by the fix we're doing for the double-encoded HTML entities that were appearing in code blocks. I have a fix that I'm about to land.

#3 @coffee2code
3 months ago

In 8803:

Developer: Use SyntaxHighligher-specific hook for more targeted fix for double-encoded HTML entities in code shortcodes.

Fixes a bug that cropped up using the previous approach that in specific situations somehow caused SyntaxHighlighter to have a code block subsume all text up to and through the next code block.

See #4457.

#4 @nosolosw
3 months ago

@coffee2code my understanding is that rev8803 was supposed to fix the issue with the subsumed text? I still see the bug, though. I went ahead and created https://meta.trac.wordpress.org/ticket/4462 to track that separately and don't hijack this ticket.

#5 follow-up: @coffee2code
3 months ago

@nosolosw: I followed up on the the ticket, but: [8803] did fix the problem, it just never got deployed to production. It has been deployed now and the issue appears resolved. Thanks for checking on it!

#6 in reply to: ↑ 5 @truongwp
3 months ago

Replying to coffee2code:

@nosolosw: I followed up on the the ticket, but: [8803] did fix the problem, it just never got deployed to production. It has been deployed now and the issue appears resolved. Thanks for checking on it!

I still see the error on the Theme Handbook page. Has it deployed on this handbook?
https://developer.wordpress.org/themes/functionality/widgets/#registering-a-widget

#7 @coffee2code
3 months ago

@truongwp: The problem @nosolosw brought up was somewhat similar but unrelated. That has been fixed. The problem you reported isn't technically fixed yet (this ticket is still open), but I have a fix for it tested locally. I'll push the fix up shortly.

#8 @coffee2code
3 months ago

  • Owner set to coffee2code
  • Resolution set to fixed
  • Status changed from new to closed

In 8843:

Developer: Fix double-encoding of > character in code shortcodes.

Props truongwp, coffee2code.
Fixes #4457.

This ticket was mentioned in Slack in #core-docs by coffee2code. View the logs.


3 months ago

#10 @coffee2code
3 months ago

#4420 was marked as a duplicate.

#11 @dingo_d
5 weeks ago

  • Component changed from Developer Hub to Handbooks
  • Resolution fixed deleted
  • Status changed from closed to reopened

Hi @coffee2code,

There seems to be this kind of issue on this page as well: https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/

Example:

<?php
public function test_user_with_editor_role_can_edit_others_posts() {
$user_id = self::factory()-&gt;user-&gt;create( array(
'role' =&gt; 'editor',
) );
 
$this-&gt;assertTrue( user_can( $user_id, 'edit_others_posts' ) );
}

Maybe the fix mentioned in 6th comment could be applied to the handbook pages as well?

I'd submit a patch but I'm not 100% sure what would be a good place to put the fix to.

This ticket was mentioned in Slack in #meta by coffee2code. View the logs.


5 weeks ago

#13 @coffee2code
4 weeks ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 9057:

Breathe: Fix double-encoding of > character in code shortcodes.

Props dingo_d, coffee2code.
See [8843].
Fixes #4457.

#14 @coffee2code
4 weeks ago

In 9061:

Breathe: Expand fix for double-encoding by SyntaxHighligher to apply to & character as well.

Props garrett-eclipse, coffee2code.
See #4457.

Note: See TracTickets for help on using tickets.