Make WordPress Core

Opened 6 weeks ago

Last modified 31 hours ago

#53138 reopened defect (bug)

Convert special HTML entities in characters in widgets descriptions

Reported by: justinahinon Owned by: audrasjb
Milestone: 5.9 Priority: normal
Severity: normal Version: trunk
Component: Widgets Keywords: needs-patch needs-testing needs-unit-tests
Focuses: Cc:


Follow up of this issue https://github.com/WordPress/gutenberg/issues/31023 on Gutenberg.

WordPress doesn't decode the HTML entities in widgets descriptions, so these one show as that in Gutenberg widget screen.

This appears in Archives, Recent posts, Meta, Recent comments widgets.

Change History (15)

This ticket was mentioned in PR #1220 on WordPress/wordpress-develop by JustinyAhin.

6 weeks ago

  • Keywords has-patch added

#2 @prbot
6 weeks ago

JustinyAhin commented on PR #1220:

Looks like there are some PHPCS issues

#3 @audrasjb
6 weeks ago

  • Milestone changed from Awaiting Review to 5.8

Yes @justinahinon, you can't use a PHP function inside a gettext function.

__( html_entity_decode( 'Your site’s most recent Posts.' ) )

Should be replaced with something like:

html_entity_decode( __( 'Your site’s most recent Posts.' ) )

Moving for 5.8 consideration since it's related to trunk.

#4 @audrasjb
6 weeks ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

#5 @justinahinon
6 weeks ago

Thank you, @audrasjb.

I have updated the PR.

#6 @audrasjb
6 weeks ago

Great, it looks good to me :)

#7 @audrasjb
8 days ago

  • Keywords commit added

Marking this for commit consideration.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.

8 days ago

#9 @whyisjake
8 days ago

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

In 51114:

Widgets: Ensure that HTML entities are converted in widget descriptions.

Fixes #53138.

Props justinahinon, audrasjb.

#10 @prbot
8 days ago

whyisjake commented on PR #1220:

Closed with #51114

#11 @SergeyBiryukov
8 days ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Thanks for the patch! However, I don't think [51114] is the correct approach here:

  • It does not account for translations. These four widgets are just the ones that have entities in their English description, translations may add or remove entities, so decoding them only for some of the widgets is not a consistent solution.
  • It does not account for custom widgets. Any custom widgets that have entities in their description would still run into the same issue.

If the block editor displays these descriptions somewhere without decoding entities first, it should be fixed there, on display, consistently for all widgets, and not in the individual widgets' constructors. So I would recommend reverting [51114] for now.

This ticket was mentioned in Slack in #core by whyisjake. View the logs.

8 days ago

#13 @hellofromTonya
8 days ago

  • Keywords needs-patch needs-testing needs-unit-tests added; has-patch commit removed
  • Milestone changed from 5.8 to 5.9

As @SergeyBiryukov notes, the patch needs more work. Also could use automated tests and testing.

As today is 5.8 Beta 1, punting to 5.9 to continue work towards resolution.

#14 @whyisjake
8 days ago

In 51127:

Widgets: Don't decode HTML entities ahead of the widget constructor.

This reverts the changes from [51114].

See #53138.

Unprops whyisjake.

#15 @ramonopoly
31 hours ago

I've created a patch over at #53407 as an alternative approach.

Last edited 31 hours ago by ramonopoly (previous) (diff)
Note: See TracTickets for help on using tickets.