#31587 closed defect (bug) (duplicate)
Network functions used before they are intialized in default-filters.php, cause Notice
Reported by: | rleeson | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | Bootstrap/Load | Keywords: | |
Focuses: | Cc: |
Description
"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.
Bug confirmed.