WordPress.org

Make WordPress Core

Opened 5 months ago

Closed 3 months ago

#53138 closed defect (bug) (duplicate)

Convert special HTML entities in characters in widgets descriptions

Reported by: justinahinon Owned by: audrasjb
Milestone: Priority: normal
Severity: normal Version: 5.8
Component: Widgets Keywords:
Focuses: Cc:

Description

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 (16)

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


5 months ago

  • Keywords has-patch added

#2 @prbot
5 months ago

JustinyAhin commented on PR #1220:

Looks like there are some PHPCS issues

#3 @audrasjb
5 months 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
5 months ago

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

#5 @justinahinon
5 months ago

Thank you, @audrasjb.

I have updated the PR.

#6 @audrasjb
5 months ago

Great, it looks good to me :)

#7 @audrasjb
4 months ago

  • Keywords commit added

Marking this for commit consideration.

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


4 months ago

#9 @whyisjake
4 months 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
4 months ago

whyisjake commented on PR #1220:

Closed with #51114

#11 @SergeyBiryukov
4 months 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.


4 months ago

#13 @hellofromTonya
4 months 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
4 months 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
3 months ago

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

Last edited 3 months ago by ramonopoly (previous) (diff)

#16 @SergeyBiryukov
3 months ago

  • Keywords needs-patch needs-testing needs-unit-tests removed
  • Milestone 5.9 deleted
  • Resolution set to duplicate
  • Status changed from reopened to closed

Closing in favor of #53407, which has a new patch and a unit test.

Note: See TracTickets for help on using tickets.