Last modified: 2012-12-31 15:11:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41447, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39447 - Weird issues with globals with litespeed SAPI
Weird issues with globals with litespeed SAPI
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.19.1
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-17 02:30 UTC by Ryan Schmidt
Modified: 2012-12-31 15:11 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Ryan Schmidt 2012-08-17 02:30:50 UTC
Wiki info:
MediaWiki 1.19.1
PHP 5.3.10 (litespeed)

I'm seriously thinking this is a litespeed SAPI bug, but filing it here just in case MediaWiki is doing something wonky...

It appears that on the above setup, global variables (such as $wgHooks and $wgAutoloadClasses) aren't being properly global-ised, in that the following event can occur:

Consider you have a wiki with 4 extensions (installed in the following order): CheckUser, LiquidThreads, FlaggedRevs, and AbuseFilter. Each of these extensions adds a hook to LoadExtensionSchemaUpdates. When adding a var_dump($wgHooks['LoadExtensionSchemaUpdates']) at the end of LocalSettings.php (after all require_once's for extensions), the hooks for FlaggedRevs do not appear but the other three hooks do show up. This is further reflected when running the updater as FlaggedRevs schema updates do not get applied. Furthermore, when adding var_dump($wgHooks['LoadExtensionSchemaUpdates']) at the end of FlaggedRevsSetup::setUnconditionalHooks(), ONLY the FlaggedRevs hook gets shown and none of the others (even though it is third in the load order). This happens even on a cleanly generated LocalSettings.php from the 1.19 web installer with the aforementioned extensions added on to the end.

I have managed to "fix" this issue by adding the statement global $wgHooks; BEFORE any of the require_once calls to extensions; adding that global statement makes all four extensions properly register their hooks, but then the wiki errors out due to class names not being found (in my case, it could not find the "Cite" class, as Cite is another extension I have loaded, although it is not listed above since it does not define the LoadExtensionSchemaUpdates hook), indicating that there is an issue with $wgAutoloadClasses as well. I managed to "fix" the issue for good by adding the following code to the top of LocalSettings.php:
foreach( $GLOBALS as $varname => $value ) {
    global $$varname;
}

However, such hacky workarounds should not be required. I'm nearly convinced that this is not a bug with MediaWiki, but rather with the litespeed SAPI being dumb somehow, but filing it here regardless so that I can take it further upstream if needed (aka we fully determine it is not a MediaWiki bug).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links