Skip to content

Commit

Permalink
fix #3753 - fix UserAgent detection for UIWebView
Browse files Browse the repository at this point in the history
  • Loading branch information
robocoder committed Feb 17, 2013
1 parent 2b78e0d commit 688f171
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions libs/UserAgentParser/UserAgentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ class UserAgentParser

// WebKit version numbers to Apple Safari version numbers (if Version/X.Y.Z not present)
static protected $safariVersions = array(
'536.25' => array('6', '0'),
'534.48' => array('5', '1'),
'533.16' => array('5', '0'),
'533.4' => array('4', '1'),
Expand Down
21 changes: 14 additions & 7 deletions tests/PHPUnit/Plugins/UserSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public function getUserAgents()
// array( browser_id, name, short_name, version, major_number, minor_number, family ),
// array( os_id, name, short_name ))),

// Special: URL encoded IE8
array('Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+GTB7.4;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0;+.NET4.0C;+.NET4.0E;+MS-RTC+LM+8;+InfoPath.2)', array(
array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'),
array('WI7', 'Windows 7', 'Win 7'))),
// Special: URL encoded IE8
array('Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+GTB7.4;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0;+.NET4.0C;+.NET4.0E;+MS-RTC+LM+8;+InfoPath.2)', array(
array('IE', 'Internet Explorer', 'IE', '8.0', '8', '0', 'ie'),
array('WI7', 'Windows 7', 'Win 7'))),

// ABrowse
array('Mozilla/5.0 (compatible; U; ABrowse 0.6; Syllable) AppleWebKit/420+ (KHTML, like Gecko)', array(
Expand Down Expand Up @@ -840,7 +840,12 @@ public function getUserAgents()
array('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50', array(
array('SF', 'Safari', 'Safari', '5.1', '5', '1', 'webkit'),
array('MAC', 'Mac OS', 'Mac OS'))),

array('Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10B141', array(
array('SF', 'Safari', 'Safari', '6.0', '6', '0', 'webkit'),
array('IPH', 'iPhone', 'iPhone'))),
array('Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B141 Safari/8536.25', array(
array('SF', 'Safari', 'Safari', '6.0', '6', '0', 'webkit'),
array('IPH', 'iPhone', 'iPhone'))),

// SeaMonkey (formerly Mozilla Suite and rebranded versions)
array('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8) Gecko/20071008 Iceape/1.1.5 (Ubuntu-1.1.5-1ubuntu0.7.10)', array(
Expand Down Expand Up @@ -953,7 +958,8 @@ public function getUserAgents()
}

/**
*
* Test getBrowser()
*
* @dataProvider getUserAgents
* @group Plugins
* @group UserSettings
Expand All @@ -979,7 +985,8 @@ public function testGetBrowser($userAgent, $expected)
}

/**
*
* Test getOperatingSystem()
*
* @dataProvider getUserAgents
* @group Plugins
* @group UserSettings
Expand Down

0 comments on commit 688f171

Please sign in to comment.