[wp-trac] [WordPress Trac] #43704: pre_option_{$option} filter is case sensitive although options are not.

WordPress Trac noreply at wordpress.org
Sat Apr 7 19:06:28 UTC 2018


#43704: pre_option_{$option} filter is case sensitive although options are not.
--------------------------------+------------------------------
 Reporter:  programmin          |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  4.9.5
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by soulseekah):

 This stems from MySQL.

 `select * from wp_options where option_name = 'siteUrl';`
 is equal to `select * from wp_options where option_name = 'siteurl';`


 `select * from wp_options where binary(option_name) = 'siteUrl';`
 is not equal to `select * from wp_options where binary(option_name) =
 'siteurl';`

 The former is used in the Options API. This is expected.

 As for your suggestion to do `pre_option_(strtolower($option))`, please
 note that:

 `add_filter( 'pre_option_MyOption' )` != `add_filter(
 'pre_option_myoption' )`

 You would need to make filter and action tags case-insensitive. This might
 break a lot of things out there.

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


More information about the wp-trac mailing list