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

WordPress Trac noreply at wordpress.org
Tue Nov 30 20:10:12 UTC 2021


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

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"52292" 52292]:
 {{{
 #!CommitTicketReference repository="" revision="52292"
 Formatting: Handle non-scalar types passed to `sanitize_key()`.

 `sanitize_key()` expects a string type for the given `key`. Passing any
 other data type to `strtolower()` can result in `E_WARNING: strtolower()
 expects parameter 1 to be string, array given`.

 A check is added that if the key is not a string, the key is set to an
 empty string. For performance, the additional string processing is skipped
 if the key is an empty string.

 This change maintains backwards-compatibility for valid string keys while
 fixing the bug of non-string keys.

 Props costdev, dd32.
 Fixes #54160.
 }}}

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


More information about the wp-trac mailing list