From 25e729cf4d5cf61d3dcd2cc5e91d23a85071d81c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Wed, 12 Aug 2015 23:18:07 +0200 Subject: [PATCH] Revert "Fix #3322 Use title for alt if no alt is provided" This reverts commit 2cf9d9f5834f417ba43fde15bc56b343e43f2814. --- htdocs/core/lib/functions.lib.php | 2 +- test/phpunit/FunctionsLibTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b3401fe58e8..6074f6fe841 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2015,7 +2015,7 @@ function img_picto($titlealt, $picto, $options = '', $pictoisfullpath = false, $ $tmparray=array(0=>$titlealt); if (preg_match('/:[^\s]/',$titlealt)) $tmparray=explode(':',$titlealt); // We explode if we have TextA:TextB. Not if we have TextA: TextB $title=$tmparray[0]; - $alt=empty($tmparray[1])?$tmparray[0]:$tmparray[1]; // Use title for alt if no alt is provided + $alt=empty($tmparray[1])?'':$tmparray[1]; return '<img src="'.$fullpathpicto.'" border="0" alt="'.dol_escape_htmltag($alt).'"'.($notitle?'':' title="'.dol_escape_htmltag($title).'"').($options?' '.$options:'').'>'; // Alt is used for accessibility, title for popup } } diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index 1ca8daefdcd..49400c119a5 100755 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -639,11 +639,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase $s=img_picto('title','/fullpath/img.png','',1); print __METHOD__." s=".$s."\n"; - $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto3'); + $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto3'); $s=img_picto('title','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; - $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="title" title="title">',$s,'testImgPicto4'); + $this->assertEquals('<img src="/fullpath/img.png" border="0" alt="" title="title">',$s,'testImgPicto4'); $s=img_picto('title:alt','/fullpath/img.png','',true); print __METHOD__." s=".$s."\n"; -- GitLab