From: Henning Snater Date: Mon, 27 May 2013 15:13:59 +0000 (+0200) Subject: ResourceLoader: Prevent prefixless modules from overwriting others X-Git-Tag: 1.31.0-rc.0~19568^2 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=85652b908fd45ec7bdc11cf6b8953ae0da4bcf6b;p=lhc%2Fweb%2Fwiklou.git ResourceLoader: Prevent prefixless modules from overwriting others Expanding prefixless modules should not overwrite the result set of expanded modules. Change-Id: Ic6e0e1c9e3fe7a585d34de21c532ee5ac3e7fdc5 --- diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php index 4588015f7c..22ff6a7ec2 100644 --- a/includes/resourceloader/ResourceLoaderContext.php +++ b/includes/resourceloader/ResourceLoaderContext.php @@ -96,7 +96,7 @@ class ResourceLoaderContext { $pos = strrpos( $group, '.' ); if ( $pos === false ) { // Prefixless modules, i.e. without dots - $retval = explode( ',', $group ); + $retval = array_merge( $retval, explode( ',', $group ) ); } else { // We have a prefix and a bunch of suffixes $prefix = substr( $group, 0, $pos ); // 'foo' diff --git a/tests/phpunit/includes/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoaderTest.php index 68db9add18..fa228a6836 100644 --- a/tests/phpunit/includes/ResourceLoaderTest.php +++ b/tests/phpunit/includes/ResourceLoaderTest.php @@ -79,7 +79,12 @@ class ResourceLoaderTest extends MediaWikiTestCase { 'Regression fixed in r88706 with dotless names', array( 'foo', 'bar', 'baz' ), 'foo,bar,baz', - ) + ), + array( + 'Prefixless modules after a prefixed module', + array( 'single.module', 'foobar', 'foobaz' ), + 'single.module|foobar,foobaz', + ), ); } }