Last modified: 2012-05-28 01:10:55 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 T38468, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36468 - Language::getNamespaces() produce fatal cause it sum array with null
Language::getNamespaces() produce fatal cause it sum array with null
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.20.x
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-03 09:07 UTC by Niklas Laxström
Modified: 2012-05-28 01:10 UTC (History)
2 users (show)

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


Attachments

Description Niklas Laxström 2012-05-03 09:07:32 UTC
Fatal error: Unsupported operand types in /www/sandwiki/languages/Language.php on line 362

When running my own unit tests.

Caused by this line in my LocalSettings.php

$wgLocalisationCacheConf['manualRecache'] = true;

The test suite should overwrite that.
Comment 1 Antoine "hashar" Musso (WMF) 2012-05-03 14:09:45 UTC
I can not reproduce the issue. Please provide a stack trace and the name of test that cause the error.  

Language::getNamespaces() seems to be summing array which does not work whenever one of the operand is null instead of an empty array. 

Code is:

$this->namespaceNames = self::$dataCache->getItem( $this->mCode, 'namespaceNames' );
$validNamespaces = MWNamespace::getCanonicalNamespaces();
$this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames + $validNamespaces;

Most probably the data cache is empty / corrupted and $this->namespaceNames ends up being null which break the sum.

Two possibles fixes would be:
- use array_merge() if it supports merging an array with a null value
- throw a nice exception whenever the getItem calls returns null

Redirecting to General component since that is not really related to unit tests.
Comment 2 Niklas Laxström 2012-05-03 14:47:07 UTC
Didn't I explain the issue clearly? If the cache is out of date (or not existing) and automatic cache creation is disabled, $dataCache->getItem returns null.

The fix is to enable automatic cache creation for unit tests.
Comment 3 Sam Reed (reedy) 2012-05-03 15:53:50 UTC
I'm sure I've seen this on the error logs of the cluster
Comment 4 Niklas Laxström 2012-05-04 18:39:22 UTC
I think it was these tests: https://gerrit.wikimedia.org/r/#/c/6518/
Comment 5 Antoine "hashar" Musso (WMF) 2012-05-15 07:38:58 UTC
Renaming bug summary

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


Navigation
Links