Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54185 closed defect (bug) (duplicate)

Cannot have `%s` in default string for `get_theme_mod`

Reported by: jqz's profile jqz Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.3
Component: Customize Keywords:
Focuses: Cc:

Description

If the default string passed to get_theme_mod() contains %s (or suchlike) it will be replaced with a URI. But if it contains %%s it will be left unchanged and not converted to %s (i.e. escaping does not work). There is no way to obtain a literal %s in the default string (other than by providing one's own implementation of the get_theme_mod function, which rather defeats the point).

This has been broken by https://github.com/WordPress/WordPress/commit/83edc2476242bebfbe050e3bbf0826cd27b3c8d4

Change History (5)

#1 @jqz
3 years ago

A typical example would be a setting which allows a CSS length value, with a default like 100%. Previously we could provide 100%% as the $default to get_theme_mod(), knowing that the function's behaviour was consistent. Now we would need to test the WordPress version to determine if this bug is present. And as stated above, some scenarios can't now be catered for at all.

#2 follow-up: @dlh
3 years ago

  • Focuses coding-standards removed
  • Version changed from trunk to 5.4

Hi @jqz, and thanks for the ticket!

I might be misunderstanding, but this sounds quite similar to the issue reported in #49421. Do you agree? If so, let's keep the discussion in that ticket.

#3 @dlh
3 years ago

  • Version changed from 5.4 to 5.3

#4 in reply to: ↑ 2 @jqz
3 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Replying to dlh:

I might be misunderstanding, but this sounds quite similar to the issue reported in #49421. Do you agree? If so, let's keep the discussion in that ticket.

Apologies, it is the same issue. Double apologies for being lazy and not searching for existing issues (I kind of assumed it was a bit niche and wouldn't have been previously reported). Triple apologies for having completely forgotten I myself had already reported this!

#5 @SergeyBiryukov
3 years ago

  • Milestone Awaiting Review deleted

Thanks for the follow-up!

Note: See TracTickets for help on using tickets.