Last modified: 2011-08-01 16:06:27 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 T29543, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27543 - Warning: in_array() [function.in-array]: Wrong datatype for second argument in ParserOptions.php
Warning: in_array() [function.in-array]: Wrong datatype for second argument i...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.18.x
All All
: Normal critical (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.keytonature.eu/wiki/Test
: patch
: 29605 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-02-18 19:50 UTC by Gregor Hagedorn
Modified: 2011-08-01 16:06 UTC (History)
6 users (show)

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


Attachments
Gero's fix (619 bytes, patch)
2011-07-30 18:23 UTC, John Du Hart
Details

Description Gregor Hagedorn 2011-02-18 19:50:15 UTC
I believe the error message (see http://www.keytonature.eu/wiki/Test ) depends on the google maps extension only, so I suspect the root cause is in the extension, although the error reports to a core module.

Version is trunk (http://www.keytonature.eu/wiki/Special:Version).
Comment 1 helix 2011-05-30 16:18:37 UTC
I think that this error has nothing to do with the extension.

PHP Warning:  in_array() expects parameter 2 to be array, boolean given in /htdocs/includes/parser/ParserOptions.php on line 297 

Seems like there is a wrong in_array call in the ParserOptions.php on line 297, 302 and 317
Comment 2 helix 2011-06-01 05:38:18 UTC
Looks like my last comment was total crap.
But I have the same problem with the DynamicPageList extension.

http://www.mediawiki.org/wiki/Extension:DynamicPageList_(third-party)
Comment 3 Gero 2011-07-30 15:47:57 UTC
I maintain DPL and I think the problem lies in ParserOutput.php, line 339.

function getUsedOptions returns "false" if no options exist, but later in ParserCache.php, line 186 the result is passed to ParserOptions.php, function optionsHash(..); This function is not aware of the fact that its argument might not be an array.

I suggest the following BUGFIX:

	/**
	 * Returns the options from its ParserOptions which have been taken 
	 * into account to produce this output or false if not available.
	 * @return mixed Array/false
	 */
	 public function getUsedOptions() {
		if ( !isset( $this->mAccessedOptions ) ) {
			return array();  // BUGFIX: return empty array !! 
			return false;
		}
		return array_keys( $this->mAccessedOptions );
	 }

This bugxif works with DPL and I am pretty sure it will also avoid the same error with any other extension ....
Comment 4 Gero 2011-07-30 15:50:29 UTC
*** Bug 29605 has been marked as a duplicate of this bug. ***
Comment 5 Mark Redekop 2011-07-30 17:48:09 UTC
Gero's solution fixed my wiki's problems, any chance of this being included in 1.18 so we don't have to keep patching it?
Comment 6 John Du Hart 2011-07-30 18:23:58 UTC
Created attachment 8850 [details]
Gero's fix
Comment 7 Mark A. Hershberger 2011-08-01 16:06:27 UTC
r93627 & 93626

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


Navigation
Links