diff --git a/DeviceDetector.php b/DeviceDetector.php index a8a8a4ae63..f9b576da1d 100644 --- a/DeviceDetector.php +++ b/DeviceDetector.php @@ -48,7 +48,7 @@ class DeviceDetector /** * Current version number of DeviceDetector */ - const VERSION = '3.6.0'; + const VERSION = '3.6.1'; /** * Holds all registered client types diff --git a/Parser/Device/DeviceParserAbstract.php b/Parser/Device/DeviceParserAbstract.php index 5122c556cf..748b3677cc 100644 --- a/Parser/Device/DeviceParserAbstract.php +++ b/Parser/Device/DeviceParserAbstract.php @@ -344,7 +344,6 @@ abstract class DeviceParserAbstract extends ParserAbstract 'VZ' => 'Vizio', 'VW' => 'Videoweb', 'WA' => 'Walton', - 'WB' => 'Web TV', 'WE' => 'WellcoM', 'WY' => 'Wexler', 'WI' => 'Wiko', @@ -353,7 +352,6 @@ abstract class DeviceParserAbstract extends ParserAbstract 'WX' => 'Woxter', 'XI' => 'Xiaomi', 'XO' => 'Xolo', - 'XX' => 'Unknown', 'YA' => 'Yarvik', 'YU' => 'Yuandao', 'YS' => 'Yusun', @@ -362,6 +360,10 @@ abstract class DeviceParserAbstract extends ParserAbstract 'ZO' => 'Zonda', 'ZP' => 'Zopo', 'ZT' => 'ZTE', + + // legacy brands, might be removed in future versions + 'WB' => 'Web TV', + 'XX' => 'Unknown' ); public function getDeviceType() @@ -462,12 +464,14 @@ public function parse() return false; } - $brandId = array_search($brand, self::$deviceBrands); - if ($brandId === false) { - // This Exception should never be thrown. If so a defined brand name is missing in $deviceBrands - throw new \Exception("The brand with name '$brand' should be listed in the deviceBrands array."); // @codeCoverageIgnore + if ($brand != 'Unknown') { + $brandId = array_search($brand, self::$deviceBrands); + if ($brandId === false) { + // This Exception should never be thrown. If so a defined brand name is missing in $deviceBrands + throw new \Exception("The brand with name '$brand' should be listed in the deviceBrands array."); // @codeCoverageIgnore + } + $this->brand = $brandId; } - $this->brand = $brandId; if (isset($regex['device']) && in_array($regex['device'], self::$deviceTypes)) { $this->deviceType = self::$deviceTypes[$regex['device']]; diff --git a/Tests/Parser/Devices/DeviceParserAbstractTest.php b/Tests/Parser/Devices/DeviceParserAbstractTest.php index c8b60115a7..b06bd9a289 100644 --- a/Tests/Parser/Devices/DeviceParserAbstractTest.php +++ b/Tests/Parser/Devices/DeviceParserAbstractTest.php @@ -28,7 +28,7 @@ public function testGetAvailableDeviceTypeNames() public function testGetFullName() { $this->assertEquals('', DeviceParserAbstract::getFullName('Invalid')); - $this->assertEquals('Unknown', DeviceParserAbstract::getFullName('XX')); + $this->assertEquals('Asus', DeviceParserAbstract::getFullName('AU')); $this->assertEquals('Google', DeviceParserAbstract::getFullName('GO')); } } diff --git a/Tests/fixtures/tv.yml b/Tests/fixtures/tv.yml index b70367b2c2..69b01c5a75 100644 --- a/Tests/fixtures/tv.yml +++ b/Tests/fixtures/tv.yml @@ -2557,7 +2557,7 @@ engine: Trident device: type: tv - brand: WB - model: + brand: + model: Web TV os_family: WebTV browser_family: Internet Explorer diff --git a/regexes/device/mobiles.yml b/regexes/device/mobiles.yml index 14a887059a..37691facf1 100644 --- a/regexes/device/mobiles.yml +++ b/regexes/device/mobiles.yml @@ -4673,11 +4673,11 @@ Fly: - regex: 'MERIDIAN-([a-z0-9]+)' model: '$1' -# Web TV -Web TV: +# Devices with undectable brand, but detectable model +Unknown: regex: 'WebTV/(\d+\.\d+)' device: 'tv' - model: '' + model: 'Web TV' # Zeemi Zeemi: