r100230 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100229‎ | r100230 | r100231 >
Date:15:15, 19 October 2011
Author:platonides
Status:ok
Tags:
Comment:
It is valid (albeit silly) to specify lang;q=1.000 No more than three decimals are allowed.
(rfc2616 section 3.9: Quality Values)
The language-range may contain more than one - (section 14.4) such as x-pig-latin
(section 3.10: Language Tags)
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebRequest.php
@@ -962,7 +962,7 @@
963963
964964 // Break up string into pieces (languages and q factors)
965965 $lang_parse = null;
966 - preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})?|\*)\s*(;\s*q\s*=\s*(1|0(\.[0-9]+)?)?)?/',
 966+ preg_match_all( '/([a-z]{1,8}(-[a-z]{1,8})*|\*)\s*(;\s*q\s*=\s*(1(\.0{0,3})?|0(\.[0-9]{0,3})?)?)?/',
967967 $acceptLang, $lang_parse );
968968
969969 if ( !count( $lang_parse[1] ) ) {

Status & tagging log