[wp-trac] [WordPress Trac] #51728: Fix uninitialized variable wp_filter

WordPress Trac noreply at wordpress.org
Sun Nov 8 04:33:03 UTC 2020


#51728: Fix uninitialized variable wp_filter
--------------------------+-----------------------------
 Reporter:  mikaelmayer   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  trunk
 Severity:  trivial       |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 In the file wp-settings.php, there is this code:

 {{{
         // Re-initialize any hooks added manually by advanced-cache.php
         if ( $wp_filter ) {
                 $wp_filter = WP_Hook::build_preinitialized_hooks(
 $wp_filter );
         }
 }}}

 However, $wp_filter is never set on a standard WordPress installation.
 Therefore, a isset should be added, so that it does not trigger useless
 NOTICEs debug statements:

 {{{
         // Re-initialize any hooks added manually by advanced-cache.php
         if ( isset($wp_filter) ) {
                 $wp_filter = WP_Hook::build_preinitialized_hooks(
 $wp_filter );
         }
 }}}

 See the PR:
 https://github.com/WordPress/wordpress-
 develop/compare/master...MikaelMayer:patch-1

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


More information about the wp-trac mailing list