Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#53138 closed defect (bug) (duplicate)

Convert special HTML entities in characters in widgets descriptions

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

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 years ago
#1

  • Keywords has-patch added

JustinyAhin commented on PR #1220:


5 years ago
#2

Looks like there are some PHPCS issues

#3 @audrasjb
5 years ago

  • Milestone Awaiting Review5.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 years ago

  • Owner set to audrasjb
  • Status newreviewing

#5 @justinahinon
5 years ago

Thank you, @audrasjb.

I have updated the PR.

#6 @audrasjb
5 years ago

Great, it looks good to me :)

#7 @audrasjb
5 years ago

  • Keywords commit added

Marking this for commit consideration.

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


5 years ago

#9 @whyisjake
5 years ago

  • Resolutionfixed
  • Status reviewingclosed

In 51114:

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

Fixes #53138.

Props justinahinon, audrasjb.

whyisjake commented on PR #1220:


5 years ago
#10

Closed with #51114

#11 @SergeyBiryukov
5 years ago

  • Resolution fixed
  • Status closedreopened

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.


5 years ago

#13 @hellofromTonya
5 years ago

  • Keywords needs-patch needs-testing needs-unit-tests added; has-patch commit removed
  • Milestone 5.85.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
5 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
5 years ago

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

Last edited 5 years ago by ramonopoly (previous) (diff)

#16 @SergeyBiryukov
5 years ago

  • Keywords needs-patch needs-testing needs-unit-tests removed
  • Milestone 5.9
  • Resolutionduplicate
  • Status reopenedclosed

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

Note: See TracTickets for help on using tickets.