WordPress.org

Make WordPress Core

Opened 4 months ago

Last modified 3 months ago

#45484 new defect (bug)

starter content theme_mods/options throw php warning if not string

Reported by: timph Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7
Component: Customize Keywords: needs-patch reporter-feedback
Focuses: Cc:

Description

theme_mods/options can be mixed:
https://developer.wordpress.org/reference/functions/set_theme_mod/
https://developer.wordpress.org/reference/functions/update_option/

When the starter content is checking for the post symbols in theme_mods/options it does a preg_match on the value, which throws PHP warnings:

here: https://github.com/WordPress/WordPress/blob/4.9-branch/wp-includes/class-wp-customize-manager.php#L1531

In the very least it would be nice if core could check if is_array. Better would be a more comprehensive check based on types, to attempt to extract the post symbols for the many types of theme_mods/options that people set.

Change History (2)

#1 @SergeyBiryukov
3 months ago

  • Keywords reporter-feedback added

Hi @timph, thanks for the ticket!

Could you provide an example of affected values and the warnings they trigger?

#2 @dlh
3 months ago

  • Version changed from 4.9.8 to 4.7
Note: See TracTickets for help on using tickets.