diff options
author | Andrey Andreev <narf@devilix.net> | 2014-01-08 23:16:46 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-01-08 23:16:46 +0100 |
commit | 10925d27adac84634cc527d7298b1add0d54ba7c (patch) | |
tree | c81e28d781f4a2668d44ed2c6461f2d9b0e4c55f /system | |
parent | 4ea76cc2216b19bfae38dbbfe7104c21ee278d81 (diff) |
Remove preg_quote() call from CI_User_agent::_set_browser() and add another pattern for Opera
Input comes from a configuration file that is barely touched by anyone
and the default values only contain letters, so it is safe to not
quote them.
This enables us to add a more advanced pattern in config/user_agents.php
for Opera 10+, which ... quote:
Opera/9.80 is hard coded at the beginning of the user agent string because of broken browser sniffing scripts which detect 'Opera/10' and above as Opera 1.
(reference: http://my.opera.com/community/openweb/idopera/)
Instead, latests versions of Opera append ' Version/<version number>'
to the end of the user agent string.
Fixes issue #555 (incorrect browser detection for Opera)
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/User_agent.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 50ac9be98..e13bf8513 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -282,7 +282,7 @@ class CI_User_agent { { foreach ($this->browsers as $key => $val) { - if (preg_match('|'.preg_quote($key).'.*?([0-9\.]+)|i', $this->agent, $match)) + if (preg_match('|'.$key.'.*?([0-9\.]+)|i', $this->agent, $match)) { $this->is_browser = TRUE; $this->version = $match[1]; |