[wp-trac] [WordPress Trac] #54160: sanitize_key() / _wp_customize_include() is not able to handle non-scalar values

WordPress Trac noreply at wordpress.org
Fri Dec 10 20:30:47 UTC 2021


#54160: sanitize_key() / _wp_customize_include() is not able to handle non-scalar
values
----------------------------------------+-----------------------------
 Reporter:  dd32                        |       Owner:  hellofromTonya
     Type:  defect (bug)                |      Status:  reopened
 Priority:  normal                      |   Milestone:  6.0
Component:  Formatting                  |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+-----------------------------

Comment (by wppunk):

 Unfortunately, but the `5.9-beta2` broken the next code:

 {{{
 sanitize_key( 1 ); // The result was '1' in 5.8
 sanitize_key( 1 ); // The result is '' in 5.9
 }}}
 Probably, we should change the code:

 {{{
 if ( ! is_string( $key ) ) {
         $key = '';
 }
 }}}


 on:
 {{{
 if ( is_array( $key ) || is_object( $key ) ) {
         $key = '';
 }
 }}}

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


More information about the wp-trac mailing list