[wp-trac] [WordPress Trac] #34290: Not possible to have a percent symbol contained in the default value of a theme_mod

WordPress Trac noreply at wordpress.org
Thu Sep 26 06:59:24 UTC 2019


#34290: Not possible to have a percent symbol contained in the default value of a
theme_mod
--------------------------+-----------------------------------------
 Reporter:  kuus          |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  accepted
 Priority:  normal        |   Milestone:  5.3
Component:  Customize     |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  javascript, administration
--------------------------+-----------------------------------------

Comment (by noisysocks):

 Let's add unit tests here so that we have a better understanding of the
 edge cases involving different control sequence and random `%` signs.

 Replying to [comment:15 aristath]:
 > If we don't want to strip `%` symbols then checking for `%s`, `%1$s` and
 `%2$s` before `sprintf` looks like a reasonable and safe solution. This
 way `sprintf` will only run if we've got a syntax where it actually makes
 sense to use `sprintf`. Otherwise this is a really annoying bug...

 The problem with this approach is that it doesn't work with all valid
 `printf` control sequences. For example, `%100s` is a valid sequence which
 pads the input string to be 100 characters wide.

 Should we consider moving away from `printf` strings?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/34290#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list