From 91d8707e848284167467ccb699a2693c58cb0c10 Mon Sep 17 00:00:00 2001 From: webchick Date: Thu, 12 Apr 2012 07:24:15 -0700 Subject: Issue #1513520: And NOW with the actual fix, not just the failing test. Sigh. :P --- includes/locale.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/locale.inc b/includes/locale.inc index bc2d58dd7..7fb8d6424 100644 --- a/includes/locale.inc +++ b/includes/locale.inc @@ -141,7 +141,7 @@ function locale_language_from_browser($languages) { // language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) // Samples: "hu, en-us;q=0.66, en;q=0.33", "hu,en-us;q=0.5" $browser_langcodes = array(); - if (preg_match_all('@([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) { + if (preg_match_all('@(?<=[, ]|^)([a-zA-Z-]+|\*)(?:;q=([0-9.]+))?(?:$|\s*,\s*)@', trim($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { // We can safely use strtolower() here, tags are ASCII. // RFC2616 mandates that the decimal part is no more than three digits, -- cgit v1.2.3