Page MenuHomePhabricator

bug in Language.php function getMagic
Closed, ResolvedPublic

Description

Author: spamfree

Description:
Trying to upgrade my wiki to version 1.10.0 I have come up with several of these ugly warning messages:

Warning: array_slice() [function.array-slice]: The first argument should be an array in /home/astrolo4/public_html/astrology/w/languages/Language.php on line 1139

I tracked it to the getMagic function. Apparently the ParserFunctions extension was establishing $wgParser->setFunctionHook's, some of which had no associated magicWord assigned to them. The getMagic function apparently has no exception handling for this kind of situation.

I have fixed things in ParserFunctions, but maybe the dev guys would find it appropriate to condition the assignment of $rawEntry to $mw->mSynonyms upon the previous 'if' not bearing out, i.e.:

if( !is_array( $rawEntry ) ) {
error_log( "\"$rawEntry\" is not a valid magic thingie for \"$mw->mId\"" );
} else { // <<<<<<<<<
$mw->mCaseSensitive = $rawEntry[0];
$mw->mSynonyms = array_slice( $rawEntry, 1 );
}

I have also reported the ParserFunctions bug appropriately.

Thanks,
Nate


Version: 1.10.x
Severity: normal

Details

Reference
bz10166

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:51 PM
bzimport set Reference to bz10166.
bzimport added a subscriber: Unknown Object (MLST).

robchur wrote:

*** Bug 10204 has been marked as a duplicate of this bug. ***