[wp-trac] [WordPress Trac] #58821: add_option() called using deprecated parameter in upgrade_630()

WordPress Trac noreply at wordpress.org
Mon Jul 17 14:39:16 UTC 2023


#58821: add_option() called using deprecated parameter in upgrade_630()
-----------------------------+-----------------------------
 Reporter:  gudmdharalds     |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Upgrade/Install  |    Version:  trunk
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 Changeset [55854] ensures that option {{{can_compress_scripts}}}
 autoloads. The changeset includes the {{{upgrade_630()}}} function that
 will record a new option value in the database to preserve what value may
 have been saved previously there. However, that function incorrectly
 invokes {{{add_option()}}} using a deprecated parameter.

 The {{{upgrade_630()}}} function looks like this in
 [https://core.trac.wordpress.org/browser/trunk/src/wp-
 admin/includes/upgrade.php?rev=56176#L2314 revision 56176]:

 {{{
 function upgrade_630() {
        global $wp_current_db_version;

         if ( $wp_current_db_version < 55853 ) {
                 if ( ! is_multisite() ) {
                         // Replace non-autoload option
 can_compress_scripts with autoload option, see #55270
                         $can_compress_scripts = get_option(
 'can_compress_scripts', false );
                         if ( false !== $can_compress_scripts ) {
                                 delete_option( 'can_compress_scripts' );
                                 add_option( 'can_compress_scripts',
 $can_compress_scripts, 'yes' );
                         }
                 }
         }
 }
 }}}

 {{{add_option()}}} is called using the
 [https://developer.wordpress.org/reference/functions/add_option/ third
 parameter, which is deprecated]. The upgrade code will cause a deprecation
 warning to be thrown when executed and WordPress is in debug mode. The
 value will be preserved nevertheless.

 Patch is attached to resolve this.

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


More information about the wp-trac mailing list