Skip to content

Commit 80d7bae

Browse files
committed
Version 2.7 (release)
1 parent ead674c commit 80d7bae

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this `PHP Browser Detection` project documented in this file.
44

5+
## [2.7] - 2023-04-27
6+
7+
### Fixed
8+
9+
- Gecko browser engine issue fixed for Gecko versions > 109 for correct Gecko version detection (see issue: https://bugzilla.mozilla.org/show_bug.cgi?id=1806690)
10+
511
## [2.6] - 2023-03-12
612

713
### Added

src/BrowserDetection.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2626
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
*
28-
* @version 2.6
29-
* @last-modified March 12, 2023
28+
* @version 2.7
29+
* @last-modified April 27, 2023
3030
* @link https://github.com/foroco/php-browser-detection
3131
*/
3232

@@ -938,6 +938,14 @@ private function getResult()
938938
if (!empty($match[1])) $this->result_browser_gecko_version = intval($match[1]);
939939
}
940940
}
941+
942+
// Gecko >= 109 issue
943+
944+
if ($this->result_browser_gecko_version >= 109)
945+
{
946+
$match = $this->match_ua('/\srv:[0-9]+\.[0-9]+\)\sGecko\/[.0-9]+\s.*Firefox\/([0-9]+)\./');
947+
if (!empty($match[1])) $this->result_browser_gecko_version = intval($match[1]);
948+
}
941949
}
942950

943951
// WebKit engine detection
@@ -1006,7 +1014,7 @@ private function getResult()
10061014
$browser_list[] = array('Cyberfox', 'Cyberfox/', '/Cyberfox\/([0-9]+)/', '1', '');
10071015
$browser_list[] = array('SeaMonkey', 'SeaMonkey/', '/SeaMonkey\/([0-9]+\.[0-9]+)/', '1', '');
10081016
$browser_list[] = array('K-Meleon', 'K-Meleon', '/K\-Meleon\/([0-9]+\.[0-9]+)/', '1', '');
1009-
$browser_list[] = array('Iceweasel', '/Ice[wW]easel/', '/Ice[wW]easel(\/|\s)([0-9]+\.[0-9]+)/', '2', '');
1017+
$browser_list[] = array('Iceweasel', '/[iI]ce[wW]easel/', '/[iI]ce[wW]easel/', '1', '');
10101018
$browser_list[] = array('IceApe', 'Iceape/', '/Iceape\/([0-9]+\.[0-9]+)/', '1', '');
10111019
$browser_list[] = array('Comodo Ice Dragon', 'IceDragon/', '/IceDragon\/([0-9]+\.[0-9]+)/', '1', '');
10121020
$browser_list[] = array('QtWeb', 'QtWeb Internet Browser/', '/QtWeb\sInternet\sBrowser\/([0-9]+\.[0-9]+)/', '1', '');
@@ -1381,6 +1389,7 @@ private function getResult()
13811389
$browsers_without_versions[] = 'Pinterest App';
13821390
$browsers_without_versions[] = 'Ali App';
13831391
$browsers_without_versions[] = 'Alipay App';
1392+
$browsers_without_versions[] = 'Iceweasel';
13841393

13851394
if (in_array($this->result_browser_name, $browsers_without_versions) || isset($darwin_app))
13861395
{

tests/gecko_issue.php

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
require_once('../src/BrowserDetection.php');
4+
$Browser = new foroco\BrowserDetection();
5+
6+
// Testing new Gecko based User-Agent strings
7+
8+
$useragent[] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:108.0) Gecko/20100101 Firefox/108.0';
9+
$useragent[] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:109.0) Gecko/20100101 Firefox/109.0';
10+
$useragent[] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:109.0) Gecko/20100101 Firefox/110.0';
11+
12+
$time_start = microtime(true);
13+
14+
foreach ($useragent as $u)
15+
{
16+
// Detect possible environment data from User-Agents
17+
$result = $Browser->getAll($u);
18+
19+
echo '<div style="font-size:16px; font-weight:bold"><pre>';
20+
echo $u;
21+
echo '</pre></div>';
22+
23+
echo '<div style="font-size:18px; font-weight:bold"><pre>';
24+
print_r($result);
25+
echo '</pre></div>';
26+
27+
echo '<div style="font-size:16px; font-weight:bold"><pre>';
28+
echo '--------------------------------------------------------------------------------';
29+
echo '</pre></div>';
30+
31+
}
32+
33+
$time_end = microtime(true);
34+
$time_result = $time_end - $time_start;
35+
36+
echo '<p style="font-size:21px">Total execution time: '.substr($time_result,0,7).' sec.</p>';
37+
38+
?>

0 commit comments

Comments
 (0)