Skip to content

Commit

Permalink
Fixes zendframework#550 - Zend_Http_UserAgent_AbstractDevice undefine…
Browse files Browse the repository at this point in the history
…d index
  • Loading branch information
froschdesign authored and Dimitris Giotas committed Jun 17, 2016
1 parent 4b976cf commit f77b604
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/Zend/Http/UserAgent/AbstractDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,9 @@ public static function extractFromUserAgent($userAgent)
}
$result['browser_version'] = '??';
}
} elseif ($product == 'mozilla' && $result['browser_version'] < 5.0) {
} elseif ($product == 'mozilla' && isset($result['browser_version'])
&& $result['browser_version'] < 5.0
) {
// handles the real Mozilla (or old Netscape if version < 5.0)
$result['browser_name'] = 'Netscape';
}
Expand Down
10 changes: 10 additions & 0 deletions tests/Zend/Http/UserAgent/AbstractDeviceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10128,4 +10128,14 @@ public function testOperaOnHtcHd2UserAgentShouldNotResultInNotices()
$capabilities = Zend_Http_UserAgent_AbstractDevice::extractFromUserAgent($userAgent);
$this->assertEquals('Opera', $capabilities['browser_name']);
}

/**
* @group GH-550
*/
public function testOnlyBrowserNameShouldNotResultInNotices()
{
$userAgent = 'Mozilla';
$capabilities = Zend_Http_UserAgent_AbstractDevice::extractFromUserAgent($userAgent);
$this->assertEquals('Mozilla', $capabilities['browser_name']);
}
}

0 comments on commit f77b604

Please sign in to comment.