[wp-trac] [WordPress Trac] #60650: sanitize_locale_name() should reject non-strings

WordPress Trac noreply at wordpress.org
Wed Feb 28 05:46:23 UTC 2024


#60650: sanitize_locale_name() should reject non-strings
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  lowest        |  Milestone:  Awaiting Review
Component:  I18N          |    Version:  6.2.1
 Severity:  trivial       |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 While debugging some locale-related oddities, I ran into
 `sanitize_locale_name()` happily accepting arrays.

 {{{
 wp> sanitize_locale_name( [ 'test at test' => 'test at test' ] );

 array(1) {
   'test at test' =>
   string(8) "testtest"
 }
 }}}

 This is not uncommon for WordPress functions that rely upon
 `preg_replace()` and a number of other sanitize functions behave
 similarly.

 I would expect an array input to return either `''` as `array( .. )` is
 not a valid  string.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60650>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list