Opened 7 years ago
Last modified 5 years ago
#42656 reopened defect (bug)
Multisite Global $pagenow variable
Reported by: | thorthecoder | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Plugins | Keywords: | |
Focuses: | multisite | Cc: |
Description
When the site is configured as multisite, plugins are loaded before "vars.php", causing plugin getting null value when trying to access the $pagenow variable.
Sample Plugin : Brightcove Video Connect
Defect : Setting page is empty
Caused by : In the setting page logic, it will check whether $pagenow is in the array of 'admin-ajax.php', 'admin.php', 'post-new.php', 'edit.php', 'post.php'. And since the $pagenow is not initialized yet, it will just display an empty page.
Change History (3)
#1
@
7 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version 4.8.3 deleted
#2
@
6 years ago
- Component changed from General to Plugins
- Focuses multisite added
- Resolution invalid deleted
- Status changed from closed to reopened
- Version set to trunk
$pagenow
not being available at mu-plugin inclusion has an additional consequence, which has not been mentioned yet.
function determine_locale()
is checking for $GLOBALS['pagenow']
in line 141. As a result, a network activated plugin, which is using one of the WP l10n functions during startup will cause a PHP Notice undefined index…
notice on the login popup window.
From a network administrator's point of view, I would not expect a big difference between a network-wide activated plugin and a plugin that I activated on every site in the network individually. (unless the plugin provides some network-specific funtionality)
Plugin authors (or at least a considerable majority of them), might expect the wp core to reliably provide an identical environment, in both cases network activation and single-site activation.
Hi @thorthecoder, welcome to Trac and thanks for opening a ticket.
This looks like an issue that should be solvable by making a small adjustment to the plugin. There's a related open issue on the GitHub repository now.
If the plugin requires
$pagenow
to determine what actions it should add (existing code), then that area of code can change to run afterplugins_loaded
fires so that$pagenow
is available to help with the decision.Note that this should only be an issue when configured as a must use (mu) plugin rather than a network or site activated plugin within multisite.