From a43416bd334bc7bbbeddc102345c0cef091b20b2 Mon Sep 17 00:00:00 2001
From: csteipp <csteipp@wikimedia.org>
Date: Tue, 19 Mar 2013 16:32:52 -0700
Subject: [PATCH] Sanitize lang param in load.php

A bad language code will cause an exception. This ensures the language
code exists, otherwise uses the site default. Uses the same function as
a normal RequestContext.

bug: 46332
Change-Id: Ia02dfbcbbcfd4dd40e0c11c75aa00e084e5830ff
---
 includes/resourceloader/ResourceLoaderContext.php |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/includes/resourceloader/ResourceLoaderContext.php b/includes/resourceloader/ResourceLoaderContext.php
index 4588015..b9492c4 100644
--- a/includes/resourceloader/ResourceLoaderContext.php
+++ b/includes/resourceloader/ResourceLoaderContext.php
@@ -146,6 +146,7 @@ class ResourceLoaderContext {
 		if ( $this->language === null ) {
 			global $wgLang;
 			$this->language = $this->request->getVal( 'lang' );
+			$this->language = RequestContext::sanitizeLangCode( $this->language );
 			if ( !$this->language ) {
 				$this->language = $wgLang->getCode();
 			}
-- 
1.7.5.4

