[wp-trac] [WordPress Trac] #61631: sanitize_option_{$option} inconsistencies

WordPress Trac noreply at wordpress.org
Thu Jul 11 13:31:28 UTC 2024


#61631: sanitize_option_{$option} inconsistencies
--------------------------------+------------------------------
 Reporter:  liedekef            |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  Awaiting Review
Component:  Options, Meta APIs  |     Version:  6.5.5
 Severity:  normal              |  Resolution:
 Keywords:                      |     Focuses:
--------------------------------+------------------------------

Comment (by liedekef):

 The example as-in on
 https://developer.wordpress.org/reference/hooks/sanitize_option_option/
 for sanitize_option_contact_email would cause a php error, so it needs to
 be corrected. The current example would cause the sanitize_email function
 to be called with 1 param only while that function in the example requires
 2 params.
 And in the register_setting function definition in wp-includes/option.php
 the add_filter code is being called with only 1 param (the callback
 function name):
 {{{
         if ( ! empty( $args['sanitize_callback'] ) ) {
                 add_filter( "sanitize_option_{$option_name}",
 $args['sanitize_callback'] );
         }
 }}}
 There's no logic on the number of params, so it results in the callback
 function to be called later on with only 1 param at all times.

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


More information about the wp-trac mailing list