r80005 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80004‎ | r80005 | r80006 >
Date:13:51, 11 January 2011
Author:catrope
Status:ok
Tags:
Comment:
Followup r80003: array_unique() preserves keys, so we got module arrays that looked like {"0": "ext.liquidThreads", "58": "mediawiki.legacy.wikibits", "59": "mediawiki.util", ... } . To prevent this from happening, use array_values() to reindex the arrays
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -233,7 +233,7 @@
234234 * @return Array of module names
235235 */
236236 public function getModules() {
237 - return array_unique( $this->mModules );
 237+ return array_values( array_unique( $this->mModules ) );
238238 }
239239
240240 /**
@@ -252,7 +252,7 @@
253253 * @return array of module names
254254 */
255255 public function getModuleScripts() {
256 - return array_unique( $this->mModuleScripts );
 256+ return array_values( array_unique( $this->mModuleScripts ) );
257257 }
258258
259259 /**
@@ -272,7 +272,7 @@
273273 * @return Array of module names
274274 */
275275 public function getModuleStyles() {
276 - return array_unique( $this->mModuleStyles );
 276+ return array_values( array_unique( $this->mModuleStyles ) );
277277 }
278278
279279 /**
@@ -292,7 +292,7 @@
293293 * @return Array of module names
294294 */
295295 public function getModuleMessages() {
296 - return array_unique( $this->mModuleMessages );
 296+ return array_values( array_unique( $this->mModuleMessages ) );
297297 }
298298
299299 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r810091.17: MFT r79839, r79862, r79863, r79895, r80003, r80005, r80164, r80692catrope00:20, 26 January 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80003Apply array_unique() to module lists in OutputPage, should prevent lots of du...catrope13:41, 11 January 2011

Status & tagging log