svn: /pear/packages/Net_UserAgent/trunk/ Detect.php tests/example.php

From: Date: Thu, 15 Apr 2010 10:14:25 +0000
Subject: svn: /pear/packages/Net_UserAgent/trunk/ Detect.php tests/example.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-59256@lists.php.net to get a copy of this message
kguest Thu, 15 Apr 2010 10:14:25 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=298020 Log: Bug #16935 Undefined offset: 1 in pear_net_useragent_detect.php:418 as PHP notice Bug: http://pear.php.net/bugs/16935 (unknown) Changed paths: U pear/packages/Net_UserAgent/trunk/Detect.php U pear/packages/Net_UserAgent/trunk/tests/example.php Modified: pear/packages/Net_UserAgent/trunk/Detect.php =================================================================== --- pear/packages/Net_UserAgent/trunk/Detect.php 2010-04-15 09:48:30 UTC (rev 298019) +++ pear/packages/Net_UserAgent/trunk/Detect.php 2010-04-15 10:14:25 UTC (rev 298020) @@ -413,8 +413,7 @@ // 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]); } Modified: pear/packages/Net_UserAgent/trunk/tests/example.php =================================================================== --- pear/packages/Net_UserAgent/trunk/tests/example.php 2010-04-15 09:48:30 UTC (rev 298019) +++ pear/packages/Net_UserAgent/trunk/tests/example.php 2010-04-15 10:14:25 UTC (rev 298020) @@ -26,7 +26,8 @@ // 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();

« previous php.pear.cvs (#59256) next »