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

bzimport added a subscriber: Unknown Object (MLST).
bzimport set Reference to bz10166.
bzimport created this task.Via LegacyJun 6 2007, 3:44 AM
bzimport added a comment.Via ConduitJun 11 2007, 6:40 AM

robchur wrote:

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

Raymond added a comment.Via ConduitDec 6 2007, 10:17 PM

Fixed with r28224.

Add Comment