diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 85690ac7c12158024cf211fd17e2035df75d584e..52c965fb0051a4bf78e805691c98f4befd0a3551 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -135,13 +135,15 @@ function getBrowserInfo($user_agent) $name='unknown'; $version=''; $os='unknown'; - $phone = 'unknown'; + $phone = ''; $detectmobile = new MobileDetect(null, $user_agent); $tablet = $detectmobile->isTablet(); if ($detectmobile->isMobile()) { + $phone = 'unknown'; + // If phone/smartphone, we set phone os name. if ($detectmobile->is('AndroidOS')) { $os = $phone = 'android'; diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 65a97881a782a6585c83a4d7034040d7165972b2..f26849231260b79a5555b261e50e2923ac0699ae 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -131,7 +131,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('ie',$tmp['browsername']); $this->assertEquals('5.0',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -140,7 +140,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('firefox',$tmp['browsername']); $this->assertEquals('0.9.1',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -148,7 +148,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('opera',$tmp['browsername']); $this->assertEquals('6.03',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -156,7 +156,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('19.0.1042.0',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -164,7 +164,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('chrome',$tmp['browsername']); $this->assertEquals('17.0.963.56',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -172,7 +172,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('safari',$tmp['browsername']); $this->assertEquals('533.21.1',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']); @@ -181,7 +181,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $tmp=getBrowserInfo($user_agent); $this->assertEquals('ie',$tmp['browsername']); $this->assertEquals('11.0',$tmp['browserversion']); - $this->assertFalse($tmp['phone']); + $this->assertEmpty($tmp['phone']); $this->assertFalse($tmp['tablet']); $this->assertEquals('classic', $tmp['layout']);