[wp-trac] [WordPress Trac] #31587: Network functions used before they are intialized in default-filters.php, cause Notice

WordPress Trac noreply at wordpress.org
Tue Mar 10 22:29:08 UTC 2015


#31587: Network functions used before they are intialized in default-filters.php,
cause Notice
----------------------------+-----------------------------
 Reporter:  rleeson         |      Owner:
     Type:  defect (bug)    |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Bootstrap/Load  |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 "Notice: Trying to get property of non-object in
 C:\vm\share\vanguard\trunk\wp-includes\functions.php on line 3834"

 Revision 31682 introduced a notice, by using is_main_site() prior to the
 network/multisite initialization.  This forces the notice when
 is_main_site() attempts a comparison on line 3834 against $current_site
 which is uninitialized at this point in execution.

 includes/default-filters.php is loaded just before the Multisite
 initialization in wp-settings.php on line 89.

 It appears the purpose of this revision was to stop loading the enclosed
 update filters on AJAX requests.

 1) Are the network/site checks appropriate/required at this point? (I
 imagine this is intended as a catch all in case the filters don't properly
 include permission checks)
 2) If so, can the filters be moved to a later/new included file after the
 network initialization? Any modification to is_main_site() would be
 indeterminant, and undermine the point of the check.
 3) If not, simplify the conditional to only check if the request is AJAX
 related.

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


More information about the wp-trac mailing list