Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#53138 closed defect (bug) (duplicate)

Convert special HTML entities in characters in widgets descriptions

Reported by: justinahinon's profile justinahinon Owned by: audrasjb's profile 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.


3 years ago
#1

  • Keywords has-patch added

JustinyAhin commented on PR #1220:


3 years ago
#2

Looks like there are some PHPCS issues

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

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

#5 @justinahinon
3 years ago

Thank you, @audrasjb.

I have updated the PR.

#6 @audrasjb
3 years ago

Great, it looks good to me :)

#7 @audrasjb
3 years ago

  • Keywords commit added

Marking this for commit consideration.

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


3 years ago

#9 @whyisjake
3 years 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.

whyisjake commented on PR #1220:


3 years ago
#10

Closed with #51114

#11 @SergeyBiryukov
3 years 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.


3 years ago

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

I've created a patch over at https://core.trac.wordpress.org/ticket/53407 as an alternative approach.

Version 0, edited 3 years ago by ramonopoly (next)

#16 @SergeyBiryukov
3 years 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.