https://bugzilla.wikimedia.org/show_bug.cgi?id=39447

       Web browser: ---
             Bug #: 39447
           Summary: Weird issues with globals with litespeed SAPI
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: General/Unknown
        AssignedTo: wikibugs-l@lists.wikimedia.org
        ReportedBy: skizz...@gmail.com
    Classification: Unclassified
   Mobile Platform: ---


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).

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to