Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug #16935 Undefined offset: 1 in pear_net_useragent_detect.php:418 a…

…s PHP notice

git-svn-id: http://svn.php.net/repository/pear/packages/Net_UserAgent/trunk@298020 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit b374f9e887da0e1d3ae060d8d1be4f913a864c6f 1 parent ce5848e
@kenguest kenguest authored
Showing with 3 additions and 3 deletions.
  1. +1 −2  Detect.php
  2. +2 −1  tests/example.php
View
3  Detect.php
@@ -413,8 +413,7 @@ function detect($in_userAgent = null, $in_detect = null)
// Set features
if ($detectFlags[NET_USERAGENT_DETECT_ALL] ||
($detectFlags[NET_USERAGENT_DETECT_BROWSER] && $detectFlags[NET_USERAGENT_DETECT_FEATURES])) {
- if ($browser['gecko']) {
- preg_match(';gecko/([\d]+)\b;i', $agt, $matches);
+ if ($browser['gecko'] && preg_match(';gecko/([\d]+)\b;i', $agt, $matches)) {
Net_UserAgent_Detect::setFeature('gecko', $matches[1]);
}
View
3  tests/example.php
@@ -26,7 +26,8 @@ function println($in_string) {
// List of user agent strings: http://www.scanmybrowser.com/ua_strings.html
Net_UserAgent_Detect::setOption('re-evaluate', true);
foreach (array('en-us' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc1) Gecko/20020417',
- 'fr' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)') as $lang => $brwsr) {
+ 'fr' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)',
+ 'Mozilla/4.0 Gecko') as $lang => $brwsr) {
putenv("HTTP_ACCEPT_LANGUAGE=$lang");
Net_UserAgent_Detect::setOption('userAgent', $brwsr);
print_info();
Please sign in to comment.
Something went wrong with that request. Please try again.