Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8c17145

Browse files
committed
Version 2.3 (release)
1 parent 5e1e7a2 commit 8c17145

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

‎CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

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

5+
## [2.3] - 2021年09月03日
6+
7+
### Added
8+
9+
- SpreadTrum based Android devices detection added.
10+
11+
### Changed
12+
13+
- Chromecast detection improvements;
14+
- MacOS Big Sur detection improvements.
15+
16+
### Fixed
17+
18+
- Chrome OS now detectable as desktop type OS;
19+
- Chrome OS devices now detectable as desktop types;
20+
- Fixed previously not identified PHP Warning Notices like 'Trying to access array offset ...' which appears since PHP version 7.4.
21+
522
## [2.2] - 2021年07月05日
623

724
### Added

‎src/BrowserDetection.php

Lines changed: 11 additions & 8 deletions
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.2
29-
* @last-modified July 5, 2021
28+
* @version 2.3
29+
* @last-modified September 3, 2021
3030
* @link https://github.com/foroco/php-browser-detection
3131
*/
3232

@@ -213,7 +213,7 @@ private function match_mobile()
213213

214214
// Match other mobile signs
215215

216-
if ($this->matchi_ua('mobile|tablet') || $this->match_ua('BlackBerry|BB10;|MIDP|PlayBook|Windows Phone|Windows Mobile|Windows CE|IEMobile|Opera Mini|OPiOS|Opera Mobi|Kindle|Silk/|Bada|Tizen|Lumia|Symbian|SymbOS|(Series|PalmOS|PalmSource|Dolfin|Crosswalk|Obigo|MQQBrowser|CriOS') || $this->matchi_ua('nokia|playstation|watch')) $this->result_mobile = 1;
216+
if ($this->matchi_ua('mobile|tablet') || $this->match_ua('BlackBerry|BB10;|MIDP|PlayBook|Windows Phone|Windows Mobile|Windows CE|IEMobile|Opera Mini|OPiOS|Opera Mobi|CrKey armv|Kindle|Silk/|Bada|Tizen|Lumia|Symbian|SymbOS|(Series|PalmOS|PalmSource|Dolfin|Crosswalk|Obigo|MQQBrowser|CriOS') || $this->matchi_ua('nokia|playstation|watch')) $this->result_mobile = 1;
217217
return NULL;
218218
}
219219

@@ -376,6 +376,7 @@ private function getResult()
376376
$version_minor = is_array($matches) ? $matches[2] : 0;
377377

378378
// macOS version to minor version conversion (needs since Big Sur)
379+
if ($version == 10 && $version_minor == 0) $version_minor = 16;
379380
if ($version == 11) $version_minor = 16;
380381
if ($version == 12) $version_minor = 17;
381382

@@ -417,7 +418,7 @@ private function getResult()
417418
{
418419
$this->result_os_family = 'linux';
419420
$this->result_os_name = $k;
420-
$this->result_os_version = (float)$matches[1];
421+
$this->result_os_version = is_array($matches) ? (float)$matches[1] : 0;
421422
$os_need_continue = FALSE;
422423
break;
423424
}
@@ -431,6 +432,7 @@ private function getResult()
431432
{
432433
$other_os = array();
433434

435+
$other_os[] = array('Chrome OS'=>'CrOS');
434436
$other_os[] = array('Linux Mint'=>'Linux Mint');
435437
$other_os[] = array('Kubuntu'=>'Kubuntu');
436438
$other_os[] = array('Ubuntu'=>'Ubuntu');
@@ -451,7 +453,6 @@ private function getResult()
451453
$other_os[] = array('Linux'=>'X11;');
452454
$other_os[] = array('Linux'=>'Mozilla/5.0 (x86_64)');
453455
$other_os[] = array('Linux'=>'Mozilla/5.0 (i686)');
454-
$other_os[] = array('Linux'=>'CrKey armv7l');
455456
$other_os[] = array('Linux'=>'U; NETFLIX');
456457
$other_os[] = array('Linux'=>'GNU; ');
457458
$other_os[] = array('AmigaOS'=>'AmigaOS');
@@ -584,7 +585,7 @@ private function getResult()
584585
$this->result_os_family = 'linux';
585586
if (strpos($k, 'Windows') !== FALSE) $this->result_os_family = 'windows';
586587
$this->result_os_name = $k;
587-
$this->result_os_version = (float)$matches[1];
588+
$this->result_os_version = is_array($matches) ? (float)$matches[1] : 0;
588589
$os_need_continue = FALSE;
589590

590591
// J2ME/MIDP or MAUI
@@ -606,7 +607,8 @@ private function getResult()
606607
{
607608
$other_os = array();
608609

609-
$other_os[] = array('Sailfish OS'=>'Sailfish');
610+
$other_os[] = array('Android'=>'CrKey armv');
611+
$other_os[] = array('Android'=>'SpreadTrum;');
610612
$other_os[] = array('BlackBerry'=>'BlackBerry');
611613
$other_os[] = array('BlackBerry'=>'BB10;');
612614
$other_os[] = array('BlackBerry'=>'RIM Tablet');
@@ -617,6 +619,7 @@ private function getResult()
617619
$other_os[] = array('KaiOS'=>'KAIOS');
618620
$other_os[] = array('RemixOS'=>'Remix Mini');
619621
$other_os[] = array('RemixOS'=>'RemixOS');
622+
$other_os[] = array('Sailfish OS'=>'Sailfish');
620623
$other_os[] = array('LiveArea'=>'PlayStation Vita');
621624
$other_os[] = array('PalmOS'=>'PalmOS');
622625
$other_os[] = array('PalmOS'=>'PalmSource');
@@ -631,6 +634,7 @@ private function getResult()
631634

632635
if ($this->match_ua($v))
633636
{
637+
if ($k === 'Android') $this->result_os_family = 'android';
634638
if ($k === 'BlackBerry') $this->result_os_family = 'blackberry';
635639
if ($k === 'Symbian') $this->result_os_family = 'symbian';
636640
if ($k === 'WatchOS') $this->result_os_family = 'macintosh';
@@ -659,7 +663,6 @@ private function getResult()
659663
{
660664
$other_os = array();
661665

662-
$other_os[] = array('Chrome OS'=>'CrOS');
663666
$other_os[] = array('WebOS'=>'hpwOS');
664667
$other_os[] = array('WebOS'=>'Web0S');
665668
$other_os[] = array('WebOS'=>'WebOS');

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /