r74139 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74138‎ | r74139 | r74140 >
Date:10:18, 2 October 2010
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Bug 25338: fixed exception in Resource Loader
Modified paths:
  • /trunk/phase3/includes/ResourceLoader.php (modified) (history)
  • /trunk/phase3/includes/ResourceLoaderContext.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/ResourceLoaderContext.php
@@ -50,7 +50,8 @@
5151 $this->resourceLoader = $resourceLoader;
5252 $this->request = $request;
5353 // Interperet request
54 - $this->modules = explode( '|', $request->getVal( 'modules' ) );
 54+ $modules = $request->getVal( 'modules' );
 55+ $this->modules = $modules ? explode( '|', $modules ) : array();
5556 $this->language = $request->getVal( 'lang' );
5657 $this->direction = $request->getVal( 'dir' );
5758 $this->skin = $request->getVal( 'skin' );
Index: trunk/phase3/includes/ResourceLoader.php
@@ -44,6 +44,9 @@
4545 * @param $context ResourceLoaderContext context to load the information within
4646 */
4747 protected function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) {
 48+ if ( !count( $modules ) ) {
 49+ return; # or Database*::select() will explode
 50+ }
4851 $dbr = wfGetDb( DB_SLAVE );
4952 $skin = $context->getSkin();
5053 $lang = $context->getLanguage();

Comments

#Comment by Catrope (talk | contribs)   22:22, 2 October 2010

Thanks for fixing this; I'll look at having the resource loader bail early if no modules were requested so we won't have any of these problems.

#Comment by Brion VIBBER (talk | contribs)   02:15, 3 October 2010

This fixes bug referenced in CR comments on r73686: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73686#c9547

Status & tagging log