From f598963d6b1975d0a87e616ac1982400b423e454 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?=
 <marcosgdf@gmail.com>
Date: Wed, 25 Feb 2015 16:41:51 +0100
Subject: [PATCH] Fixed regression

---
 htdocs/core/lib/functions.lib.php |  4 +++-
 test/phpunit/FunctionsLibTest.php | 14 +++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 85690ac7c12..52c965fb005 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 65a97881a78..f2684923126 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']);
 
-- 
GitLab