diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e37045ef88b..db5de85015d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3673,6 +3673,7 @@ function dol_textishtml($msg,$option=0) elseif (preg_match('/<(br|div|font|img|li|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|img|li|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; + elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) return false; @@ -4532,4 +4533,4 @@ function natural_search($fields, $value) return " AND " . ($end > 1? '(' : '') . $res; } -?> +?> \ No newline at end of file diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index b8414dd170e..342a7074ce9 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -186,6 +186,9 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $input='xxx
'; $after=dol_textishtml($input); $this->assertTrue($after); + $input='

abc

'; + $after=dol_textishtml($input); + $this->assertTrue($after); // False $input='xxx < br>'; @@ -528,16 +531,16 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase public function testVerifCond() { $verifcond=verifCond('1==1'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test a true comparison'); $verifcond=verifCond('1==2'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test a false comparison'); $verifcond=verifCond('$conf->facture->enabled'); - $this->assertTrue($verifcond); + $this->assertTrue($verifcond,'Test that conf property of a module report true when enabled'); $verifcond=verifCond('$conf->moduledummy->enabled'); - $this->assertFalse($verifcond); + $this->assertFalse($verifcond,'Test that conf property of a module report false when disabled'); $verifcond=verifCond(''); $this->assertTrue($verifcond);