Index: trunk/phase3/includes/resourceloader/ResourceLoaderFileModule.php |
— | — | @@ -139,9 +139,20 @@ |
140 | 140 | case 'languageScripts': |
141 | 141 | case 'skinScripts': |
142 | 142 | case 'skinStyles': |
143 | | - foreach ( (array) $option as $key => $value ) { |
| 143 | + if ( !is_array( $option ) ) { |
| 144 | + throw new MWException( |
| 145 | + "Invalid collated file path list error. '$option' given, array expected." |
| 146 | + ); |
| 147 | + } |
| 148 | + foreach ( $option as $key => $value ) { |
| 149 | + if ( !is_string( $key ) ) { |
| 150 | + throw new MWException( |
| 151 | + "Invalid collated file path list key error. '$key' given, string expected." |
| 152 | + ); |
| 153 | + } |
144 | 154 | $this->{$member}[$key] = self::prefixFilePathList( (array) $value, $basePath ); |
145 | 155 | } |
| 156 | + break; |
146 | 157 | // Lists of strings |
147 | 158 | case 'dependencies': |
148 | 159 | case 'messages': |
— | — | @@ -209,6 +220,7 @@ |
210 | 221 | // Merge general styles and skin specific styles, retaining media type collation |
211 | 222 | $styles = self::readStyleFiles( $this->styles ); |
212 | 223 | $skinStyles = self::readStyleFiles( self::tryForKey( $this->skinStyles, $context->getSkin(), 'default' ) ); |
| 224 | + |
213 | 225 | foreach ( $skinStyles as $media => $style ) { |
214 | 226 | if ( isset( $styles[$media] ) ) { |
215 | 227 | $styles[$media] .= $style; |
— | — | @@ -329,12 +341,14 @@ |
330 | 342 | protected static function prefixFilePathList( array $list, $prefix ) { |
331 | 343 | $prefixed = array(); |
332 | 344 | foreach ( $list as $key => $value ) { |
333 | | - if ( is_array( $value ) ) { |
| 345 | + if ( is_string( $key ) && is_array( $value ) ) { |
334 | 346 | // array( [path] => array( [options] ) ) |
335 | 347 | $prefixed[$prefix . $key] = $value; |
336 | | - } else { |
| 348 | + } else if ( is_int( $key ) && is_string( $value ) ) { |
337 | 349 | // array( [path] ) |
338 | 350 | $prefixed[$key] = $prefix . $value; |
| 351 | + } else { |
| 352 | + throw new MWException( "Invalid file path list error. '$key' => '$value' given." ); |
339 | 353 | } |
340 | 354 | } |
341 | 355 | return $prefixed; |