[wp-trac] [WordPress Trac] #40682: get_current_blog_id() and get_current_network_id() are loaded before absint()
WordPress Trac
noreply at wordpress.org
Mon Jun 26 19:01:07 UTC 2017
#40682: get_current_blog_id() and get_current_network_id() are loaded before
absint()
--------------------------------+------------------------------
Reporter: wonderboymusic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Networks and Sites | Version: 3.5
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: multisite
--------------------------------+------------------------------
Comment (by flixos90):
I suggest moving `get_current_blog_id()` and `get_current_network_id()` to
`wp-includes/functions.php` as a first step. These two are the only
functions in `wp-includes/load.php` that use `absint()`, and they
shouldn't be called there anyway.
However `absint()` is not the only function that is not available at this
point. For `get_current_network_id()`, the function `get_network()` is not
available either (`get_main_network_id()` uses that function as well btw),
and for `get_current_blog_id()` the `$blog_id` global won't be set when
called early.
These multisite-API-related parts should probably be handled afterwards in
a separate ticket, as there are many other functions in core that assume
the functions are available. The other thing is, even if they were
available they wouldn't work that early as the multisite bootstrap process
would not have been completed yet. We should investigate checking
something like `did_action( 'ms_loaded' )` in such functions to make sure
they fail gracefully.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40682#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list