[wp-trac] [WordPress Trac] #51827: When a plugin makes use of the 'automatic_updater_disabled' filter, it causes a PHP Warning to be thrown.

WordPress Trac noreply at wordpress.org
Thu Nov 19 18:17:17 UTC 2020


#51827: When a plugin makes use of the 'automatic_updater_disabled' filter, it
causes a PHP Warning to be thrown.
-----------------------------------------+-----------------------
 Reporter:  jamesros161                  |       Owner:  audrasjb
     Type:  defect (bug)                 |      Status:  accepted
 Priority:  normal                       |   Milestone:  5.6
Component:  Upgrade/Install              |     Version:  5.6
 Severity:  normal                       |  Resolution:
 Keywords:  needs-patch has-screenshots  |     Focuses:
-----------------------------------------+-----------------------

Comment (by jamesros161):

 Replying to [comment:4 audrasjb]:
 > Hi, welcome to WordPress Trac and thank you for reporting this,
 >
 > I am able to reproduce the issue using the steps provided by
 @jamesros161.
 >
 > But at a glance, I think the following logic should be enough:
 > {{{
 > if ( defined( 'AUTOMATIC_UPDATER_DISABLED' ) && true ===
 AUTOMATIC_UPDATER_DISABLED || has_filter( 'automatic_updater_disabled' )
 && true === apply_filters( 'automatic_updater_disabled', false ) ) {
 >     $upgrade_dev   = false;
 >     $upgrade_minor = false;
 >     $upgrade_major = false;
 >
 >     // The UI is overridden using a constant or a filter.
 >     $can_set_update_option = false;
 > }
 > }}}
 >
 > I should be able to test it deeper later today.

 The issue is, that in the original code, the $can_set_update_option is
 executed regardless of whether or not AUTOMATIC_UPDATER_DISABLED or
 apply_filters( 'automatic_updater_disabled') are true, as long as the
 constant is defined, and the filter exists.

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


More information about the wp-trac mailing list