diff --git a/dev/fpdf/makefont/makefont.php b/dev/fpdf/makefont/makefont.php
index 07b530da5b08d81e50ea3bf3a80fc0a8f02e5c42..9fa11878a8a7f5268c452c2ae3fb07757c98b055 100644
--- a/dev/fpdf/makefont/makefont.php
+++ b/dev/fpdf/makefont/makefont.php
@@ -232,7 +232,7 @@ function SaveToFile($file,$s,$mode='t')
 	$f=fopen($file,'w'.$mode);
 	if(!$f)
 		die('Can\'t write to file '.$file);
-	fwrite($f,$s,strlen($s));
+	fwrite($f,$s,dol_strlen($s));
 	fclose($f);
 }
 
diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php
index 6527041c43f82583c54c0cafcd1e90b66189f6b9..60a539a6c74d7c5049d1abc26e78fb6a98422369 100644
--- a/dev/skeletons/build_class_from_table.php
+++ b/dev/skeletons/build_class_from_table.php
@@ -230,7 +230,7 @@ foreach($property as $key => $prop)
 		$varprop.="\t\t\$sql.= \" ";
 		if ($prop['istime'])
 		{
-			$varprop.='".(! isset($this->'.$prop['field'].') || strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
+			$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
 			$varprop.="\$this->".$prop['field']."";
 			$varprop.='))."';
 			if ($i < sizeof($property)) $varprop.=",";
@@ -271,8 +271,8 @@ foreach($property as $key => $prop)
 		$varprop.=$prop['field'].'=';
 		if ($prop['istime'])
 		{
-			// (strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
-			$varprop.='".(strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
+			// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
+			$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
 			$varprop.='$this->'.$prop['field'];
 			$varprop.=')."\'" : \'null\').';
 			$varprop.='"';
diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php
index 9a66b4817686cbdd32fa51cecec7516bfd51ffee..98f826cbc61e9ad210491106ea955d9127703b53 100644
--- a/htdocs/admin/boxes.php
+++ b/htdocs/admin/boxes.php
@@ -206,7 +206,7 @@ if ($resql)
 		{
 			while ($record = $db->fetch_array($result))
 			{
-				if (strlen($record['box_order']) == 1)
+				if (dol_strlen($record['box_order']) == 1)
 				{
 					if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
 					{
@@ -221,7 +221,7 @@ if ($resql)
 						$resql = $db->query($sql);
 					}
 				}
-				else if (strlen($record['box_order']) == 2)
+				else if (dol_strlen($record['box_order']) == 2)
 				{
 					if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
 					{
diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index d139b8c1bcc2131b23b6ab9341ac3029d2087ca7..6d901dd95d6e130cf416ff2f88737e73dc7a756f 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -214,9 +214,9 @@ if ($handle)
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
+		if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
 
@@ -334,8 +334,8 @@ while (($file = readdir($handle))!==false)
 {
 	if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
 	{
-		$name = substr($file, 4, strlen($file) -16);
-		$classname = substr($file, 0, strlen($file) -12);
+		$name = substr($file, 4, dol_strlen($file) -16);
+		$classname = substr($file, 0, dol_strlen($file) -12);
 
 		$var=!$var;
 		print "<tr ".$bc[$var].">\n  <td>";
diff --git a/htdocs/admin/dons.php b/htdocs/admin/dons.php
index 273f324798c939fa19984e38def26db2890da02b..82c67bd5935105517c0eb76d1fc8b1a960864a57 100644
--- a/htdocs/admin/dons.php
+++ b/htdocs/admin/dons.php
@@ -182,8 +182,8 @@ while (($file = readdir($handle))!==false)
     if (preg_match('/\.modules\.php$/i',$file))
     {
         $var = !$var;
-        $name = substr($file, 0, strlen($file) -12);
-        $classname = substr($file, 0, strlen($file) -12);
+        $name = substr($file, 0, dol_strlen($file) -12);
+        $classname = substr($file, 0, dol_strlen($file) -12);
 
 		require_once($dir.'/'.$file);
 		$module=new $classname($db);
diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php
index be6c30de5801cf174db564d3a3745122a13f2bb1..016727c94c52b9ab5106114456dd729dc4362811 100644
--- a/htdocs/admin/expedition.php
+++ b/htdocs/admin/expedition.php
@@ -306,10 +306,10 @@ if(is_dir($dir))
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
+		if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
 		{
-			$name = substr($file, 15, strlen($file) - 27);
-			$classname = substr($file, 0, strlen($file) - 12);
+			$name = substr($file, 15, dol_strlen($file) - 27);
+			$classname = substr($file, 0, dol_strlen($file) - 12);
 
 			$var=!$var;
 			print "<tr $bc[$var]><td>";
diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 37da46c05702b0cb6ce31183d4145a2b10c6f016..0045e494edf9ce59bae3cf4a81a661f7b5d96da1 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -272,7 +272,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
 						$classname = "mod_facture_".$file;
 					}
 					//print "x".$dir."-".$filebis."-".$classname;
-					if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, strlen($filebis)-3, 3) == 'php')
+					if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
 					{
 						// Chargement de la classe de numerotation
 						require_once($dir.$filebis);
@@ -418,8 +418,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
 				if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
 				{
 					$var = !$var;
-					$name = substr($file, 4, strlen($file) -16);
-					$classname = substr($file, 0, strlen($file) -12);
+					$name = substr($file, 4, dol_strlen($file) -16);
+					$classname = substr($file, 0, dol_strlen($file) -12);
 
 					require_once($dir.$file);
 					$module = new $classname($db);
diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php
index f94dfe8c8e77597af7116559c4316db0d005b313..cb690a37cd741a68da07923793edbc9e49ecf93d 100644
--- a/htdocs/admin/fichinter.php
+++ b/htdocs/admin/fichinter.php
@@ -306,10 +306,10 @@ $var=true;
 $handle=opendir($dir);
 while (($file = readdir($handle))!==false)
 {
-	if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
+	if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
 	{
-		$name = substr($file, 4, strlen($file) -16);
-		$classname = substr($file, 0, strlen($file) -12);
+		$name = substr($file, 4, dol_strlen($file) -16);
+		$classname = substr($file, 0, dol_strlen($file) -12);
 
 		$var=!$var;
 
diff --git a/htdocs/admin/fournisseur.php b/htdocs/admin/fournisseur.php
index 15c5b3cfe8d0d53b6c32315188a8f56ec24f0cda..af104ef5bbcfb51138ea17975655f7dbbe2f1e5e 100644
--- a/htdocs/admin/fournisseur.php
+++ b/htdocs/admin/fournisseur.php
@@ -190,9 +190,9 @@ if ($handle)
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php')
+		if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php");
 
@@ -310,8 +310,8 @@ while (($file = readdir($handle))!==false)
 {
 	if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
 	{
-		$name = substr($file, 4, strlen($file) -16);
-		$classname = substr($file, 0, strlen($file) -12);
+		$name = substr($file, 4, dol_strlen($file) -16);
+		$classname = substr($file, 0, dol_strlen($file) -12);
 
 		$var=!$var;
 		print "<tr ".$bc[$var].">\n  <td>$name";
diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php
index f7e97b6de17d474bb89d2e84597edf43cbdf60d3..24713357125dced4f35b9ecdf1cedbf239ba8ed3 100644
--- a/htdocs/admin/livraison.php
+++ b/htdocs/admin/livraison.php
@@ -212,9 +212,9 @@ if ($handle)
     $var=true;
     while (($file = readdir($handle))!==false)
     {
-        if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, strlen($file)-3, 3) == 'php')
+        if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php");
 
@@ -331,10 +331,10 @@ if(is_dir($dir))
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
+		if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
 		{
-			$name = substr($file, 4, strlen($file) - 16);
-			$classname = substr($file, 0, strlen($file) - 12);
+			$name = substr($file, 4, dol_strlen($file) - 16);
+			$classname = substr($file, 0, dol_strlen($file) - 12);
 
 			$var=!$var;
 			print "<tr $bc[$var]><td>";
diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php
index 74d1fcb22be35eb6401403db0324e40a6f0e745c..893f172cb7ee0f9367668f109b28f587d47b0942 100644
--- a/htdocs/admin/modules.php
+++ b/htdocs/admin/modules.php
@@ -233,9 +233,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
 		while (($file = readdir($handle))!==false)
 		{
 			//print "$i ".$file."\n<br>";
-		    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod'  && substr($file, strlen($file) - 10) == '.class.php')
+		    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod'  && substr($file, dol_strlen($file) - 10) == '.class.php')
 		    {
-		        $modName = substr($file, 0, strlen($file) - 10);
+		        $modName = substr($file, 0, dol_strlen($file) - 10);
 
 		        if ($modName)
 		        {
diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php
index 0bbca339df20104c85210a2ef134a1138be131d7..4e9187462969fd8c8caaf44124f4389b05a2e5a9 100644
--- a/htdocs/admin/osc-languages.php
+++ b/htdocs/admin/osc-languages.php
@@ -34,7 +34,7 @@ accessforbidden();
 llxHeader();
 
 
-if (! strlen(OSC_DB_NAME))
+if (! dol_strlen(OSC_DB_NAME))
 {
 	print "Non dispo";
 	llxFooter();
diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php
index e10aae7ed85aeadfef693274d846195641297658..65a39b418e5c87bf5c0445d1f7e7a56772f64983 100644
--- a/htdocs/admin/perms.php
+++ b/htdocs/admin/perms.php
@@ -88,9 +88,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
 	{
 		while (($file = readdir($handle))!==false)
 		{
-		    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
+		    if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
 		    {
-		        $modName = substr($file, 0, strlen($file) - 10);
+		        $modName = substr($file, 0, dol_strlen($file) - 10);
 
 		        if ($modName)
 		        {
diff --git a/htdocs/admin/project.php b/htdocs/admin/project.php
index 39d8e1e9f5e859f748f0f42366e90fe98299f5c5..cfc9fe2cde1021f2e7e902c501784aaac8cfc764 100644
--- a/htdocs/admin/project.php
+++ b/htdocs/admin/project.php
@@ -179,9 +179,9 @@ if ($handle)
 
 	while (($file = readdir($handle))!==false)
 	{
-		if (substr($file, 0, 12) == 'mod_project_' && substr($file, strlen($file)-3, 3) == 'php')
+		if (substr($file, 0, 12) == 'mod_project_' && substr($file, dol_strlen($file)-3, 3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/project/".$file.".php");
 
@@ -298,8 +298,8 @@ while (($file = readdir($handle))!==false)
 {
 	if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
 	{
-		$name = substr($file, 4, strlen($file) -16);
-		$classname = substr($file, 0, strlen($file) -12);
+		$name = substr($file, 4, dol_strlen($file) -16);
+		$classname = substr($file, 0, dol_strlen($file) -12);
 
 		$var=!$var;
 		print "<tr ".$bc[$var].">\n  <td>$name";
diff --git a/htdocs/admin/propale.php b/htdocs/admin/propale.php
index 9732eff4e43ec21e2b02c254dfae738a99e4889c..de5ae3e810e72d7f6f7c348639072826e36f3d1b 100644
--- a/htdocs/admin/propale.php
+++ b/htdocs/admin/propale.php
@@ -216,9 +216,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
 		{
 			while (($file = readdir($handle))!==false)
 			{
-				if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
+				if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php')
 				{
-					$file = substr($file, 0, strlen($file)-4);
+					$file = substr($file, 0, dol_strlen($file)-4);
 
 					require_once($dir.$file.".php");
 
@@ -335,10 +335,10 @@ $handle=opendir($dir);
 $var=true;
 while (($file = readdir($handle))!==false)
 {
-	if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
+	if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
 	{
-		$name = substr($file, 12, strlen($file) - 24);
-		$classname = substr($file, 0, strlen($file) -12);
+		$name = substr($file, 12, dol_strlen($file) - 24);
+		$classname = substr($file, 0, dol_strlen($file) -12);
 
 		$var=!$var;
 		print "<tr ".$bc[$var].">\n  <td>";
diff --git a/htdocs/admin/societe.php b/htdocs/admin/societe.php
index 302c5a120123f0c1d6a5d3afbc4a1b835e6333a3..6fe20ccc94a5521a348b1819cf89a09b57f39d72 100644
--- a/htdocs/admin/societe.php
+++ b/htdocs/admin/societe.php
@@ -196,7 +196,7 @@ if ($handle)
 	{
 		if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
 
@@ -265,7 +265,7 @@ if ($handle)
 	{
 		if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
 		{
-			$file = substr($file, 0, strlen($file)-4);
+			$file = substr($file, 0, dol_strlen($file)-4);
 
 			require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
 
@@ -355,8 +355,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
 				if (preg_match('/\.modules\.php$/i',$file))
 				{
 					$var = !$var;
-					$name = substr($file, 4, strlen($file) -16);
-					$classname = substr($file, 0, strlen($file) -12);
+					$name = substr($file, 4, dol_strlen($file) -16);
+					$classname = substr($file, 0, dol_strlen($file) -12);
 
 					require_once($dir.'/'.$file);
 					$module = new $classname($db);
diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php
index 1692ee8aa8b1ae6214e6cfce942ef88c31588f93..8566885e40f060b52db9b7bd2d6f64714e4389df 100644
--- a/htdocs/admin/system/modules.php
+++ b/htdocs/admin/system/modules.php
@@ -55,9 +55,9 @@ foreach($conf->file->dol_document_root as $searchdir)
 	$handle=opendir($dirtoscan);
 	while (($file = readdir($handle))!==false)
 	{
-		if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
+		if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
 		{
-			$modName = substr($file, 0, strlen($file) - 10);
+			$modName = substr($file, 0, dol_strlen($file) - 10);
 
 			if ($modName)
 			{
diff --git a/htdocs/cashdesk/facturation_dhtml.php b/htdocs/cashdesk/facturation_dhtml.php
index 9a1dcf2c3a4e8e628ad230391ad84f10ab015501..f5fd1b6bee4993416b9d2841bb67ff8bab83fcf1 100644
--- a/htdocs/cashdesk/facturation_dhtml.php
+++ b/htdocs/cashdesk/facturation_dhtml.php
@@ -42,7 +42,7 @@ require(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
 header("Content-type: text/html; charset=".$conf->file->character_set_client);
 
 // Search from criteria
-if ( strlen ($_GET["code"]) >= 0 )	// If search criteria is on char length at least
+if ( dol_strlen ($_GET["code"]) >= 0 )	// If search criteria is on char length at least
 {
 	$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
 	if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 76939acc99696bdad6bd6daa889839c357f335fc..6702ce34a4db211095dd04812d14879f65e5b519 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -634,7 +634,7 @@ class Categorie
 			$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
 		}
 		// We count number of _ to have level
-		$this->cats[$id_categ]['level']=strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));
+		$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));
 
 		// Process all childs on several levels of this category
 		$protection++;
diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php
index 31f13302c5541712adb3057393c038852be4959b..f3a297d38f882ec9df8c73874de5dd0d93c2d9f4 100644
--- a/htdocs/comm/contact.php
+++ b/htdocs/comm/contact.php
@@ -87,12 +87,12 @@ if ($type == "p") $sql.= " AND s.client IN (2, 3)";
 if ($type == "f") $sql.= " AND s.fournisseur = 1";
 if ($socid) $sql.= " AND s.rowid = ".$socid;
 
-if (strlen($stcomm))
+if (dol_strlen($stcomm))
 {
   $sql.= " AND s.fk_stcomm=$stcomm";
 }
 
-if (strlen($begin)) // filtre sur la premiere lettre du nom
+if (dol_strlen($begin)) // filtre sur la premiere lettre du nom
 {
   $sql.= " AND upper(p.name) like '$begin%'";
 }
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 66b8f4ef60d95f225c8ebb9bc70f28393c16bf21..65979e86cb418e5407f3cc92d6d1a543ef58d5b9 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -466,7 +466,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 				}
 			}
 
-			if (strlen($sendto))
+			if (dol_strlen($sendto))
 			{
 				$langs->load("commercial");
 
@@ -478,7 +478,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 
 				if ($_POST['action'] == 'send')
 				{
-					if (strlen($_POST['subject'])) $subject = $_POST['subject'];
+					if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
 					else $subject = $langs->transnoentities('Propal').' '.$propal->ref;
 					$actiontypecode='AC_PROP';
 					$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
@@ -1713,7 +1713,7 @@ else
 	{
 		$sql.= " AND date_format(p.datep, '%Y') = $year";
 	}
-	if (strlen($_POST['sf_ref']) > 0)
+	if (dol_strlen($_POST['sf_ref']) > 0)
 	{
 		$sql.= " AND p.ref like '%".addslashes($_POST["sf_ref"]) . "%'";
 	}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 74fe268024602bfe7755035a1d1572b10c4e7b54..a41c05fea4cc780049fb884ca8ede7dd7188da15 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -864,7 +864,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 				}
 			}
 
-			if (strlen($sendto))
+			if (dol_strlen($sendto))
 			{
 				$langs->load("commercial");
 
@@ -876,7 +876,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 
 				if ($_POST['action'] == 'send')
 				{
-					if (strlen($_POST['subject'])) $subject=$_POST['subject'];
+					if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
 					else $subject = $langs->transnoentities('Order').' '.$commande->ref;
 					$actiontypecode='AC_COM';
 					$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
diff --git a/htdocs/compta/class/comptacompte.class.php b/htdocs/compta/class/comptacompte.class.php
index fd8d0b711c275ab686b83924a220735c2e59f692..b7b3537f0991ec138ff6d4f7fc38dddace3f4ad6 100644
--- a/htdocs/compta/class/comptacompte.class.php
+++ b/htdocs/compta/class/comptacompte.class.php
@@ -55,7 +55,7 @@ class ComptaCompte
 
   function create($user)
     {
-      if (strlen(trim($this->numero)) && strlen(trim($this->intitule)))
+      if (dol_strlen(trim($this->numero)) && dol_strlen(trim($this->intitule)))
 	{
 	  $sql = "SELECT count(*)";
 	  $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux ";
diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php
index 2178009a90407ed5fe3b6461549166de2c52377d..3bca42e3cfdbc09186a4b081fd287275d985e998 100644
--- a/htdocs/compta/clients.php
+++ b/htdocs/compta/clients.php
@@ -105,7 +105,7 @@ $sql.= " WHERE s.fk_stcomm = st.id AND s.client=1";
 $sql.= " AND s.entity = ".$conf->entity;
 if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 
-if (strlen($stcomm))
+if (dol_strlen($stcomm))
 {
 	$sql.= " AND s.fk_stcomm=$stcomm";
 }
@@ -132,7 +132,7 @@ if ($_GET["search_code_client"])
 	$sql.= " AND s.code_client like '%".addslashes($_GET["search_code_client"])."%'";
 }
 
-if (strlen($begin))
+if (dol_strlen($begin))
 {
 	$sql.= " AND s.nom like '".addslashes($begin)."'";
 }
diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php
index 8a523208f6d6147903d65d9f4de7336c0785f66e..dc41aba506231cbf56adf134e3f542580cfbd243 100644
--- a/htdocs/compta/commande/liste.php
+++ b/htdocs/compta/commande/liste.php
@@ -85,7 +85,7 @@ if (isset($_GET["afacturer"]) && $_GET['afacturer'] == 1)
 {
     $sql.= " AND fk_statut >=1	AND c.facture = 0";
 }
-if (strlen($_POST["sf_ref"]) > 0)
+if (dol_strlen($_POST["sf_ref"]) > 0)
 {
     $sql.= " AND c.ref like '%".$_POST["sf_ref"] . "%'";
 }
diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php
index b9ba4bdb52beb997ac572e8c3cac9e9a5df9a454..700167de5d0031ead3b5664c76771b8b2b98d16f 100644
--- a/htdocs/compta/dons/class/don.class.php
+++ b/htdocs/compta/dons/class/don.class.php
@@ -209,34 +209,34 @@ class Don extends CommonObject
 	{
 		$err = 0;
 
-		if (strlen(trim($this->societe)) == 0)
+		if (dol_strlen(trim($this->societe)) == 0)
 		{
-			if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0)
+			if ((dol_strlen(trim($this->nom)) + dol_strlen(trim($this->prenom))) == 0)
 			{
 				$error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe.";
 				$err++;
 			}
 		}
 
-		if (strlen(trim($this->adresse)) == 0)
+		if (dol_strlen(trim($this->adresse)) == 0)
 		{
 			$error_string[$err] = "L'adresse saisie est invalide";
 			$err++;
 		}
 
-		if (strlen(trim($this->cp)) == 0)
+		if (dol_strlen(trim($this->cp)) == 0)
 		{
 			$error_string[$err] = "Le code postal saisi est invalide";
 			$err++;
 		}
 
-		if (strlen(trim($this->ville)) == 0)
+		if (dol_strlen(trim($this->ville)) == 0)
 		{
 			$error_string[$err] = "La ville saisie est invalide";
 			$err++;
 		}
 
-		if (strlen(trim($this->email)) == 0)
+		if (dol_strlen(trim($this->email)) == 0)
 		{
 			$error_string[$err] = "L'email saisi est invalide";
 			$err++;
@@ -245,7 +245,7 @@ class Don extends CommonObject
 		$this->amount = trim($this->amount);
 
 		$map = range(0,9);
-		for ($i = 0; $i < strlen($this->amount) ; $i++)
+		for ($i = 0; $i < dol_strlen($this->amount) ; $i++)
 		{
 			if (!isset($map[substr($this->amount, $i, 1)] ))
 			{
diff --git a/htdocs/compta/export/class/ComptaJournalPaiement.class.php b/htdocs/compta/export/class/ComptaJournalPaiement.class.php
index 7001882afcdaa670e7b39751cab10754014fd984..9324f2c14ca7fbda969b8b2b9829019fe51365b7 100644
--- a/htdocs/compta/export/class/ComptaJournalPaiement.class.php
+++ b/htdocs/compta/export/class/ComptaJournalPaiement.class.php
@@ -164,7 +164,7 @@ class ComptaJournalPaiement
 					$socnom = $obj->nom;
 					$libelle = $obj->libelle;
 
-					if (strlen($obj->nom) > 31)
+					if (dol_strlen($obj->nom) > 31)
 					{
 						$socnom = substr($obj->nom, 0 , 31);
 					}
@@ -190,7 +190,7 @@ class ComptaJournalPaiement
 					$s = $socnom . ' '.$libelle;
 
 					$facnumber = $obj->facnumber;
-					if (strlen(trim($obj->increment)) > 0)
+					if (dol_strlen(trim($obj->increment)) > 0)
 					{
 						$facnumber = $obj->increment;
 					}
diff --git a/htdocs/compta/export/class/ComptaJournalVente.class.php b/htdocs/compta/export/class/ComptaJournalVente.class.php
index 3da1ec4fd69e4924c01464b50dc3a22f97074b6c..458cb0ffdeadd78f67f8cad45ae319fb6187cb63 100644
--- a/htdocs/compta/export/class/ComptaJournalVente.class.php
+++ b/htdocs/compta/export/class/ComptaJournalVente.class.php
@@ -157,12 +157,12 @@ class ComptaJournalVente  {
 					$tva = abs($obj->tva);
 
 					$facnumber = $obj->facnumber;
-					if (strlen(trim($obj->increment)) > 0)
+					if (dol_strlen(trim($obj->increment)) > 0)
 					{
 						$facnumber = $obj->increment;
 					}
 
-					if (strlen($obj->nom) > 31)
+					if (dol_strlen($obj->nom) > 31)
 					{
 						$socnom = substr($obj->nom, 0 , 31);
 					}
diff --git a/htdocs/compta/export/index.php b/htdocs/compta/export/index.php
index 94ab0a1d76d8d73f6db0d6025e697d1c9ede546f..2d82b4d5bd2a61147c98c080a76bfe734a03f83b 100644
--- a/htdocs/compta/export/index.php
+++ b/htdocs/compta/export/index.php
@@ -138,7 +138,7 @@ if ($handle)
 {
   while (($file = readdir($handle))!==false)
     {
-      if (is_readable($updir.$file) && is_dir($updir.$file) && strlen($file) == 4)
+      if (is_readable($updir.$file) && is_dir($updir.$file) && dol_strlen($file) == 4)
 	{
 	  $var=!$var;
 	  print '<tr '.$bc[$var].'><td><a href="index.php?year='.$file.'">'.$file.'</a><td></tr>';
diff --git a/htdocs/compta/export/modules/compta.export.class.php b/htdocs/compta/export/modules/compta.export.class.php
index ebe6ce4ab75284da88afdc451ec3944dc93ea8d1..8a76251b1ee7cadf6c9981b9e244a0f47612380d 100644
--- a/htdocs/compta/export/modules/compta.export.class.php
+++ b/htdocs/compta/export/modules/compta.export.class.php
@@ -178,7 +178,7 @@ class ComptaExport
 	  	$this->linep[$i][5] = $obj->amount;
 	  	$this->linep[$i][6] = $obj->libelle;
 
-	  	if (strlen(trim( $obj->increment)) > 0)
+	  	if (dol_strlen(trim( $obj->increment)) > 0)
 	  	{
 	  		$this->linep[$i][7] = $obj->increment;
 	  	}
diff --git a/htdocs/compta/export/modules/compta.export.safran.class.php b/htdocs/compta/export/modules/compta.export.safran.class.php
index 006057c88657dd2c1ed5a785919daa6eabb092e1..7c1c5d284c5e8d3e357e3396447aba4e3cc073e6 100644
--- a/htdocs/compta/export/modules/compta.export.safran.class.php
+++ b/htdocs/compta/export/modules/compta.export.safran.class.php
@@ -47,7 +47,7 @@ class ComptaExportTableur extends ComptaExport
 
       $fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls";
 
-      if (strlen(trim($this->fournisseur->email_commande)) == 0)
+      if (dol_strlen(trim($this->fournisseur->email_commande)) == 0)
         {
 	  return -3;
         }
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 6b6112e75483e6a24fc770b56040043461ce6957..a6eb0799a1ac666f2cd77a16a961535d8b4c1d3f 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -1166,7 +1166,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
 				}
 			}
 
-			if (strlen($sendto))
+			if (dol_strlen($sendto))
 			{
 				$langs->load("commercial");
 
@@ -1178,7 +1178,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
 
 				if ($_POST['action'] == 'send')
 				{
-					if (strlen($_POST['subject'])) $subject = $_POST['subject'];
+					if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
 					else $subject = $langs->transnoentities('Bill').' '.$fac->ref;
 					$actiontypecode='AC_FAC';
 					$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
@@ -1192,7 +1192,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
 				}
 				if ($_POST['action'] == 'relance')
 				{
-					if (strlen($_POST['subject'])) $subject = $_POST['subject'];
+					if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
 					else $subject = $langs->transnoentities('Relance facture '.$fac->ref);
 					$actiontypecode='AC_FAC';
 					$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index ac6cc86f687e4727c4d7562ae4c66b42a43f876b..ae3287de0bfc7f20bc01f1b08fcf53fa25d20e1d 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -434,7 +434,7 @@ class FactureRec extends Facture
 
 			// \TODO A virer
 			// Anciens indicateurs: $price, $remise (a ne plus utiliser)
-			if (trim(strlen($remise_percent)) > 0)
+			if (trim(dol_strlen($remise_percent)) > 0)
 			{
 				$remise = round(($pu * $remise_percent / 100), 2);
 				$price = $pu - $remise;
diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php
index 110c3f671e1ead2c09693cb7f15e48e1e54fb36d..c045f362e70ffe064a75fbfa23c7b6d69895902a 100644
--- a/htdocs/compta/facture/impayees.php
+++ b/htdocs/compta/facture/impayees.php
@@ -211,7 +211,7 @@ if ($_REQUEST["search_montant_ttc"])
 	$sql .= " AND f.total_ttc = '".$_REQUEST["search_montant_ttc"]."'";
 }
 
-if (strlen($_POST["sf_ref"]) > 0)
+if (dol_strlen($_POST["sf_ref"]) > 0)
 {
 	$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
 }
diff --git a/htdocs/compta/param/comptes/liste.php b/htdocs/compta/param/comptes/liste.php
index 52b2364c8336cdf886ede6c9583ff67e9cb1fc03..87c5bea61b0a0109913a4f06f6ce5065262ceb63 100644
--- a/htdocs/compta/param/comptes/liste.php
+++ b/htdocs/compta/param/comptes/liste.php
@@ -50,12 +50,12 @@ $sql = "SELECT cg.rowid, cg.numero, cg.intitule, cg.date_creation as dc";
 
 $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux as cg";
 
-if (strlen(trim($_GET["search_numero"])) )
+if (dol_strlen(trim($_GET["search_numero"])) )
 {
 
   $sql .= " WHERE cg.numero LIKE '%".$_GET["search_numero"]."%'";
 
-  if ( strlen(trim($_GET["search_intitule"])))
+  if ( dol_strlen(trim($_GET["search_intitule"])))
     {
       $sql .= " AND cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
     }
@@ -63,7 +63,7 @@ if (strlen(trim($_GET["search_numero"])) )
 }
 else
 {
-  if ( strlen(trim($_GET["search_intitule"])))
+  if ( dol_strlen(trim($_GET["search_intitule"])))
     {
       $sql .= " WHERE cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
     }
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index f3d419cad7d3484592a897f164d572fd3316e121..570e0c9d3e81f2fa239e73f037ab5cb6ba43eb1d 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -79,7 +79,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
 if (!$statut) $sql.= " AND pfd.traite = 0";
 if ($statut) $sql.= " AND pfd.traite = ".$statut;
 $sql.= " AND pfd.fk_facture = f.rowid";
-if (strlen(trim($_GET["search_societe"])))
+if (dol_strlen(trim($_GET["search_societe"])))
 {
 	$sql.= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
 }
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index 48293067b7742ab1fbb6eab6bf3bc7b0cd6b88f7..eeb4d7ac87cc8bf391a94f71538978aad5ffafd7 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -556,9 +556,9 @@ class PaiementCharge extends CommonObject
 		$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
 
 		$sql.= " fk_charge=".(isset($this->fk_charge)?$this->fk_charge:"null").",";
-		$sql.= " datec=".(strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
-		$sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
-		$sql.= " datep=".(strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
+		$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
+		$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
+		$sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
 		$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
 		$sql.= " fk_typepaiement=".(isset($this->fk_typepaiement)?$this->fk_typepaiement:"null").",";
 		$sql.= " num_paiement=".(isset($this->num_paiement)?"'".addslashes($this->num_paiement)."'":"null").",";
diff --git a/htdocs/compta/ventilation/fournisseur/lignes.php b/htdocs/compta/ventilation/fournisseur/lignes.php
index 05d8db6ce5f8109851962d06f4dd264c2493cc40..e0bb4a69db5ed8d0c45fa273f6f89414b9035574 100644
--- a/htdocs/compta/ventilation/fournisseur/lignes.php
+++ b/htdocs/compta/ventilation/fournisseur/lignes.php
@@ -55,7 +55,7 @@ $sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
 $sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
 $sql .= " AND c.rowid = l.fk_code_ventilation";
 
-if (strlen(trim($_GET["search_facture"])))
+if (dol_strlen(trim($_GET["search_facture"])))
 {
   $sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
 }
diff --git a/htdocs/compta/ventilation/lignes.php b/htdocs/compta/ventilation/lignes.php
index 6ef4fd246cd4b280f57d581a24b472e800d0f08f..ba8721582a0a2d82aaf05aab560295a0486e14bb 100644
--- a/htdocs/compta/ventilation/lignes.php
+++ b/htdocs/compta/ventilation/lignes.php
@@ -59,7 +59,7 @@ $sql.= " , ".MAIN_DB_PREFIX."facturedet as l";
 $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
 $sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
 $sql.= " AND c.rowid = l.fk_code_ventilation";
-if (strlen(trim($_GET["search_facture"])))
+if (dol_strlen(trim($_GET["search_facture"])))
 {
 	$sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
 }
diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php
index 89a855db67c5d3db09e48896161e67e65b0585db..199b60d8ea0326b42539f6d8b146b37e83ea3662 100644
--- a/htdocs/contact/class/contact.class.php
+++ b/htdocs/contact/class/contact.class.php
@@ -306,7 +306,7 @@ class Contact extends CommonObject
 			$info["phpgwContactCatId"] = 0;
 			$info["phpgwContactAccess"] = "public";
 
-			if (strlen($this->egroupware_id) == 0)
+			if (dol_strlen($this->egroupware_id) == 0)
 			{
 				$this->egroupware_id = 1;
 			}
diff --git a/htdocs/contact/fiche.php b/htdocs/contact/fiche.php
index f8b1628b1057960ee830774ed5e35b3f10bd795b..2ddc89814bdc5a8563237e20885fc1e513361db4 100644
--- a/htdocs/contact/fiche.php
+++ b/htdocs/contact/fiche.php
@@ -334,17 +334,17 @@ if ($user->rights->societe->contact->creer)
 		print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.(isset($_POST["poste"])?$_POST["poste"]:$contact->poste).'"></td>';
 
 		// Address
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address;	// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><textarea class="flat" name="address" cols="70">'.(isset($_POST["address"])?$_POST["address"]:$contact->address).'</textarea></td>';
 
 		// Zip / Town
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp;			// Predefined with third party
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville;	// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp;			// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80" value="'.(isset($_POST["cp"])?$_POST["cp"]:$contact->cp).'">&nbsp;';
 		print '<input name="ville" type="text" size="20" value="'.(isset($_POST["ville"])?$_POST["ville"]:$contact->ville).'" maxlength="80"></td></tr>';
 
 		// Country
-		if (strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id;	// Predefined with third party
+		if (dol_strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
 		$form->select_pays((isset($_POST["pays_id"])?$_POST["pays_id"]:$contact->fk_pays),'pays_id',$conf->use_javascript_ajax?' onChange="company_save_refresh_create()"':'');
 		if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
@@ -363,16 +363,16 @@ if ($user->rights->societe->contact->creer)
 		print '</td></tr>';
 
 		// Phone / Fax
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel;	// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$contact->phone_pro).'"></td>';
 		print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$contact->phone_perso).'"></td></tr>';
 
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax;	// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$contact->phone_mobile).'"></td>';
 		print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.(isset($_POST["fax"])?$_POST["fax"]:$contact->fax).'"></td></tr>';
 
 		// EMail
-		if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email;	// Predefined with third party
+		if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email;	// Predefined with third party
 		print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.(isset($_POST["email"])?$_POST["email"]:$contact->email).'"></td></tr>';
 
 		// Jabberid
diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php
index 80abb4f95204ab2fbf57eb293bf235aab4ea5e9a..18fb9eed3de402b5ffd01cdbfd9db68146018b82 100644
--- a/htdocs/contact/vcard.php
+++ b/htdocs/contact/vcard.php
@@ -90,7 +90,7 @@ $filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
 
 
 Header("Content-Disposition: attachment; filename=\"".$filename."\"");
-Header("Content-Length: ".strlen($output));
+Header("Content-Length: ".dol_strlen($output));
 Header("Connection: close");
 Header("Content-Type: text/x-vcard; name=\"".$filename."\"");
 
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 614a14a1300cfc871d0fdf069871777af69ba925..2d58d6b65f6eba59c0830b89b3cdb0d0257f1240 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -104,8 +104,8 @@ class Contrat extends CommonObject
 		$this->db->begin();
 
 		$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
-		$sql.= " date_ouverture = ".(strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
-		$sql.= " date_fin_validite = ".(strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
+		$sql.= " date_ouverture = ".(dol_strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
+		$sql.= " date_fin_validite = ".(dol_strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
 		$sql.= " fk_user_ouverture = ".$user->id.",";
 		$sql.= " date_cloture = null,";
 		$sql.= " commentaire = '".addslashes($comment)."'";
@@ -562,7 +562,7 @@ class Contrat extends CommonObject
 		$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
 		$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
 		$sql.= ",".($this->fk_projet>0?$this->fk_projet:"NULL");
-		$sql .= ", " . (strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
+		$sql .= ", " . (dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
 		$sql.= ")";
 		$resql=$this->db->query($sql);
 		if ($resql)
@@ -805,7 +805,7 @@ class Contrat extends CommonObject
 			// Anciens indicateurs: $price, $remise (a ne plus utiliser)
 			$remise = 0;
 			$price = price2num(round($pu_ht, 2));
-			if (strlen($remise_percent) > 0)
+			if (dol_strlen($remise_percent) > 0)
 			{
 				$remise = round(($pu_ht * $remise_percent / 100), 2);
 				$price = $pu_ht - $remise;
@@ -899,7 +899,7 @@ class Contrat extends CommonObject
 		$localtax2tx = price2num($localtax2tx);
 		$subprice = $price;
 		$remise = 0;
-		if (strlen($remise_percent) > 0)
+		if (dol_strlen($remise_percent) > 0)
 		{
 			$remise = round(($pu * $remise_percent / 100), 2);
 			$price = $pu - $remise;
diff --git a/htdocs/core/class/cookie.class.php b/htdocs/core/class/cookie.class.php
index d76a17161a1fe89670f0b8c0bcd06a1cc2881661..16191188195876c4324ab981bb0557b0aee189fd 100644
--- a/htdocs/core/class/cookie.class.php
+++ b/htdocs/core/class/cookie.class.php
@@ -62,7 +62,7 @@ class DolCookie
 		if (!empty($this->myKey))
 		{
 			$valuecrypt = base64_encode($this->myValue);
-			for ($f=0 ; $f<=strlen($valuecrypt)-1; $f++)
+			for ($f=0 ; $f<=dol_strlen($valuecrypt)-1; $f++)
 			{
 				$this->cookie .= intval(ord($valuecrypt[$f]))*$this->myKey."|";
 			}
@@ -191,7 +191,7 @@ class DolCookie
 			$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
 			if ($fp = @fopen($file,'w'))
 			{
-				fputs($fp, $config, strlen($config));
+				fputs($fp, $config, dol_strlen($config));
 				fclose($fp);
 				// It's config file, so we set permission for creator only
 				// @chmod($file, octdec('0600'));
diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php
index 2ff4bc232eceb1ecc85787ac3345b29c88b84f26..d36733ca4ec2c309a7b1415f0c2d6affcf4fb895 100644
--- a/htdocs/core/class/dolgraph.class.php
+++ b/htdocs/core/class/dolgraph.class.php
@@ -355,7 +355,7 @@ class DolGraph
 	{
 		$max = $this->GetMaxValueInData();
 		if ($max != 0) $max++;
-		$size=strlen(abs(ceil($max)));
+		$size=dol_strlen(abs(ceil($max)));
 		$factor=1;
 		for ($i=0; $i < ($size-1); $i++)
 		{
@@ -378,7 +378,7 @@ class DolGraph
 	{
 		$min = $this->GetMinValueInData();
 		if ($min != 0) $min--;
-		$size=strlen(abs(floor($min)));
+		$size=dol_strlen(abs(floor($min)));
 		$factor=1;
 		for ($i=0; $i < ($size-1); $i++)
 		{
@@ -452,7 +452,7 @@ class DolGraph
 
 		$paddleft=50;
 		$paddright=10;
-		$strl=strlen(max(abs($this->MaxValue),abs($this->MinValue)));
+		$strl=dol_strlen(max(abs($this->MaxValue),abs($this->MinValue)));
 		if ($strl > 6) $paddleft += ($strln * 4);
 		$group->setPadding($paddleft, $paddright);		// Width on left and right for Y axis values
 		$group->legend->setSpace(0);
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 45c2f47fffcaa7cd3bfb48ceadbc6683eebd725d..08837f60a9e0f628cfbf86fc7577cfbd9f6b5d77 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1007,8 +1007,8 @@ class Form
                 $found=0;
                 $currencytext=$langs->trans("Currency".$conf->monnaie);
                 $currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie);
-                if (strlen($currencytext) > 10) $currencytext=$conf->monnaie;	// If text is too long, we use the short code
-                if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie;   // If text is too long, we use the short code
+                if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie;	// If text is too long, we use the short code
+                if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie;   // If text is too long, we use the short code
 
                 // Multiprice
                 if ($price_level >= 1)		// If we need a particular price level (from 1 to 6)
@@ -1069,7 +1069,7 @@ class Form
 
                 if ($objp->duration)
                 {
-                    $duration_value = substr($objp->duration,0,strlen($objp->duration)-1);
+                    $duration_value = substr($objp->duration,0,dol_strlen($objp->duration)-1);
                     $duration_unit = substr($objp->duration,-1);
                     if ($duration_value > 1)
                     {
@@ -1242,8 +1242,8 @@ class Form
                 {
                     $currencytext=$langs->trans("Currency".$conf->monnaie);
                     $currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie);
-                    if (strlen($currencytext) > 10) $currencytext=$conf->monnaie;   // If text is too long, we use the short code
-                    if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie;   // If text is too long, we use the short code
+                    if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie;   // If text is too long, we use the short code
+                    if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie;   // If text is too long, we use the short code
 
                     $opt.= price($objp->fprice).' '.$currencytext."/".$objp->quantity;
                     $outval.= price($objp->fprice).' '.$currencytextnoent."/".$objp->quantity;
@@ -2427,14 +2427,14 @@ class Form
         }
 
         // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
-        if ($defaulttx < 0 || strlen($defaulttx) == 0)
+        if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
         {
             $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
             $defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
         }
         // Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
         // Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
-        if ($defaulttx < 0 || strlen($defaulttx) == 0)
+        if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
         {
             $defaulttx = $txtva[sizeof($txtva)-1];
         }
@@ -2676,7 +2676,7 @@ class Form
             if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
             for ($hour = 0; $hour < 24; $hour++)
             {
-                if (strlen($hour) < 2)
+                if (dol_strlen($hour) < 2)
                 {
                     $hour = "0" . $hour;
                 }
@@ -2702,7 +2702,7 @@ class Form
             if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
             for ($min = 0; $min < 60 ; $min++)
             {
-                if (strlen($min) < 2)
+                if (dol_strlen($min) < 2)
                 {
                     $min = "0" . $min;
                 }
diff --git a/htdocs/core/class/notify.class.php b/htdocs/core/class/notify.class.php
index 41d497260db82b350048c571bdbbf88f89f64c62..83e1375bf44535f09168716bea553d53a1edf745 100644
--- a/htdocs/core/class/notify.class.php
+++ b/htdocs/core/class/notify.class.php
@@ -152,7 +152,7 @@ class Notify
                 $sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">";
 				$actiondefid = $obj->adid;
 
-                if (strlen($sendto))
+                if (dol_strlen($sendto))
                 {
                 	include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
                 	$application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index acf84cf22f6fa632063b93800518617155ec740d..7f235472ea9bd1156ed18262d19cfe45763d7bc9 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -611,7 +611,7 @@ class EcmDirectory // extends CommonObject
 			$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
 		}
 		// We count number of _ to have level
-		$this->cats[$id_categ]['level']=strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
+		$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
 
 		// Traite ces enfants
 		$protection++;
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index bc62ac16599c82f53b975302b107f8e3827baeb8..a73baa571edefd443007fa92b35cb7665066bd35 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -604,16 +604,16 @@ class Expedition extends CommonObject
         // Update request
         $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
 
-		$sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
+		$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
 		$sql.= " ref=".(isset($this->ref)?"'".addslashes($this->ref)."'":"null").",";
 		$sql.= " ref_customer=".(isset($this->ref_customer)?"'".addslashes($this->ref_customer)."'":"null").",";
 		$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
-		$sql.= " date_creation=".(strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
+		$sql.= " date_creation=".(dol_strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
 		$sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").",";
-		$sql.= " date_valid=".(strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').",";
+		$sql.= " date_valid=".(dol_strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').",";
 		$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
-		$sql.= " date_expedition=".(strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
-		$sql.= " date_delivery=".(strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
+		$sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
+		$sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
 		$sql.= " fk_address=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").",";
 		$sql.= " fk_expedition_methode=".(isset($this->expedition_method_id)?$this->expedition_method_id:"null").",";
 		$sql.= " tracking_number=".(isset($this->tracking_number)?"'".addslashes($this->tracking_number)."'":"null").",";
diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php
index 0a46f9c66645b2e706aed148e1137744f7ef33a1..074809155cd60ff16924aa01ca53d488c26c537c 100644
--- a/htdocs/expedition/fiche.php
+++ b/htdocs/expedition/fiche.php
@@ -667,7 +667,7 @@ else
 				$expedition->fetch_object();
 			}
 
-			if (strlen($expedition->tracking_number))
+			if (dol_strlen($expedition->tracking_number))
 			{
 				$expedition->GetUrlTrackingStatus();
 			}
diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php
index 8de12d235b432c4f213f331fdaa9a8d6112a9426..7b4080f5d29cb916eee4f8c8df93dd8bca9e35c8 100644
--- a/htdocs/fichinter/class/fichinter.class.php
+++ b/htdocs/fichinter/class/fichinter.class.php
@@ -174,7 +174,7 @@ class Fichinter extends CommonObject
 		global $conf;
 
 		if (! is_numeric($this->duree)) { $this->duree = 0; }
-		if (! strlen($this->fk_project)) { $this->fk_project = 0; }
+		if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; }
 
 		/*
 		 *  Insertion dans la base
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 8b697baa38c3de4c76d0e41b0c16734c10cc1846..53dff0b493876bb8e571a05416a49c0159a3e68c 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -614,7 +614,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 				}
 			}
 
-			if (strlen($sendto))
+			if (dol_strlen($sendto))
 			{
 				$langs->load("commercial");
 
@@ -626,7 +626,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
 
 				if ($_POST['action'] == 'send')
 				{
-					if (strlen($_POST['subject'])) $subject=$_POST['subject'];
+					if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
 					else $subject = $langs->transnoentities('CustomerOrder').' '.$commande->ref;
 					$actiontypecode='AC_SUP_ORD';
 					$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php
index a4240548c5569b044f48db66f0f62be280e76dfe..9bae9fbb24e7a32bb08fcedc3461e6a893be0ff5 100644
--- a/htdocs/fourn/commande/liste.php
+++ b/htdocs/fourn/commande/liste.php
@@ -106,7 +106,7 @@ if ($sall)
 }
 if ($socid) $sql.= " AND s.rowid = ".$socid;
 
-if (strlen($_GET["statut"]))
+if (dol_strlen($_GET["statut"]))
 {
 	$sql .= " AND fk_statut =".$_GET["statut"];
 }
diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php
index 6c3aa016563830ba2ef9dcff8e1cfef2b0bda71b..9cef3874718361bb1cc5a0d3de4ab346014612af 100644
--- a/htdocs/fourn/contact.php
+++ b/htdocs/fourn/contact.php
@@ -68,11 +68,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI
 $sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.rowid = p.fk_soc";
 if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
 
-if (strlen($stcomm)) {
+if (dol_strlen($stcomm)) {
   $sql .= " AND s.fk_stcomm=$stcomm";
 }
 
-if (strlen($begin)) {
+if (dol_strlen($begin)) {
   $sql .= " AND p.name like '$begin%'";
 }
 
diff --git a/htdocs/fourn/facture/impayees.php b/htdocs/fourn/facture/impayees.php
index f99834bac8c332964eb2fb6c6c56571bd4441958..64dbff428e7d2f1bfad75e934ead0b3bb144dffe 100644
--- a/htdocs/fourn/facture/impayees.php
+++ b/htdocs/fourn/facture/impayees.php
@@ -125,7 +125,7 @@ if ($user->rights->fournisseur->facture->lire)
 		$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
 	}
 
-	if (strlen($_POST["sf_ref"]) > 0)
+	if (dol_strlen($_POST["sf_ref"]) > 0)
 	{
 		$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
 	}
diff --git a/htdocs/includes/boxes/box_factures.php b/htdocs/includes/boxes/box_factures.php
index 9228fc2ddcad58a435bbc92e69a81e843b626e5b..3644c72b7ae6462a48c4b00d5a57b9240ff4fdd5 100644
--- a/htdocs/includes/boxes/box_factures.php
+++ b/htdocs/includes/boxes/box_factures.php
@@ -67,7 +67,7 @@ class box_factures extends ModeleBoxes {
 		$text = $langs->trans("BoxTitleLastCustomerBills",$max);
 		$this->info_box_head = array(
 				'text' => $text,
-				'limit'=> strlen($text)
+				'limit'=> dol_strlen($text)
 		);
 
 		if ($user->rights->facture->lire)
diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php
index af46f94579ac7bf02422f415fcbed23a7a1f393f..2261541bd42dae0d4d55908bf2f12a799b76a739 100644
--- a/htdocs/includes/modules/DolibarrModules.class.php
+++ b/htdocs/includes/modules/DolibarrModules.class.php
@@ -885,9 +885,9 @@ class DolibarrModules
 
 					if (empty($r_type)) $r_type='w';
 
-					if (strlen($r_perms) )
+					if (dol_strlen($r_perms) )
 					{
-						if (strlen($r_subperms) )
+						if (dol_strlen($r_subperms) )
 						{
 							$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
 							$sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)";
diff --git a/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php b/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php
index 72e5c850d7e9fa028903b086bf163582b9617e7b..1d6eab229703d132a50dd43ef1f76a53a65d7d98 100644
--- a/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php
+++ b/htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php
@@ -80,7 +80,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs)
 	$dir = DOL_DOCUMENT_ROOT . "/includes/modules/cheque/pdf/";
 
 	// Positionne modele sur le nom du modele a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->FACTURE_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/dons/modules_don.php b/htdocs/includes/modules/dons/modules_don.php
index 99a71af6c8b785219c17a7a7e6ab10f882125285..6ef01d0731fa008334c9c54db77a02f2047f8a55 100644
--- a/htdocs/includes/modules/dons/modules_don.php
+++ b/htdocs/includes/modules/dons/modules_don.php
@@ -147,7 +147,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
     $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/";
 
 	// Positionne modele sur le nom du modele � utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->DON_ADDON_MODEL)
 		{
diff --git a/htdocs/includes/modules/facture/modules_facture.php b/htdocs/includes/modules/facture/modules_facture.php
index b32548282f464adca7ff7585a48101cb92896bdd..27b15b2cd4fdf6a8841fc85080ebc848aa3e27fe 100644
--- a/htdocs/includes/modules/facture/modules_facture.php
+++ b/htdocs/includes/modules/facture/modules_facture.php
@@ -149,7 +149,7 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
 	$dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/";
 
 	// Positionne modele sur le nom du modele a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->FACTURE_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/fichinter/modules_fichinter.php b/htdocs/includes/modules/fichinter/modules_fichinter.php
index fee94cba1366071460bf8d021c7ebf750951bff8..bf4b2c638cdeb1f9a667397128e39889eae77402 100644
--- a/htdocs/includes/modules/fichinter/modules_fichinter.php
+++ b/htdocs/includes/modules/fichinter/modules_fichinter.php
@@ -153,7 +153,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
 	$dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
 
 	// Positionne modele sur le nom du modele de facture a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->FICHEINTER_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/import/import_csv.modules.php b/htdocs/includes/modules/import/import_csv.modules.php
index 1f14cc282af53bbb75fdf8e95bf27fc1f9d3f628..077ca9e21b81cbf23005dbadc94b0bc07c01bc3d 100644
--- a/htdocs/includes/modules/import/import_csv.modules.php
+++ b/htdocs/includes/modules/import/import_csv.modules.php
@@ -226,12 +226,12 @@ class ImportCsv extends ModeleImports
 		    		if (strtolower($conf->global->IMPORT_CSV_FORCE_CHARSET) == 'utf8')
 		    		{
 		    			$newarrayres[$key]['val']=$val;
-		    			$newarrayres[$key]['type']=(strlen($val)?1:-1);	// If empty we considere it's null
+		    			$newarrayres[$key]['type']=(dol_strlen($val)?1:-1);	// If empty we considere it's null
 		    		}
 		    		else
 		    		{
 		    			$newarrayres[$key]['val']=utf8_encode($val);
-		    			$newarrayres[$key]['type']=(strlen($val)?1:-1);	// If empty we considere it's null
+		    			$newarrayres[$key]['type']=(dol_strlen($val)?1:-1);	// If empty we considere it's null
 		    		}
 		    	}
 		    	else	// Autodetect format (UTF8 or ISO)
@@ -239,12 +239,12 @@ class ImportCsv extends ModeleImports
 					if (utf8_check($val))
 					{
 						$newarrayres[$key]['val']=$val;
-						$newarrayres[$key]['type']=(strlen($val)?1:-1);	// If empty we considere it's null
+						$newarrayres[$key]['type']=(dol_strlen($val)?1:-1);	// If empty we considere it's null
 					}
 					else
 					{
 						$newarrayres[$key]['val']=utf8_encode($val);
-						$newarrayres[$key]['type']=(strlen($val)?1:-1);	// If empty we considere it's null
+						$newarrayres[$key]['type']=(dol_strlen($val)?1:-1);	// If empty we considere it's null
 					}
 		    	}
 			}
diff --git a/htdocs/includes/modules/livraison/modules_livraison.php b/htdocs/includes/modules/livraison/modules_livraison.php
index 286e1df754ec4f9c7099c9d4e0f41f3d6c727bbf..b00a0f9034a5634bfd9a7cf7effd4f4bf08366f4 100644
--- a/htdocs/includes/modules/livraison/modules_livraison.php
+++ b/htdocs/includes/modules/livraison/modules_livraison.php
@@ -147,7 +147,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
 	$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/";
 
 	// Positionne modele sur le nom du modele de bon de livraison a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->LIVRAISON_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/mailings/peche.modules.php b/htdocs/includes/modules/mailings/peche.modules.php
index ad1d46e451a6ad9ed50cf9bb5f475a74fde0489f..2989ed2df23f87c4a43d96d5a667f0d740e38339 100644
--- a/htdocs/includes/modules/mailings/peche.modules.php
+++ b/htdocs/includes/modules/mailings/peche.modules.php
@@ -143,7 +143,7 @@ class mailing_peche extends MailingTargets
 				        $other=$tab[3];
 				        if (! empty($buffer))
 				        {
-			        		//print 'xx'.strlen($buffer).empty($buffer)."<br>\n";
+			        		//print 'xx'.dol_strlen($buffer).empty($buffer)."<br>\n";
 				        	$id=$cpt;
 					        if (isValidEMail($email))
 					        {
diff --git a/htdocs/includes/modules/member/cards/modules_cards.php b/htdocs/includes/modules/member/cards/modules_cards.php
index 761920db8b291205d9f9c973ac77ad6548c2828c..29a04a084c19617b9ebb699e7b35c86b011a0af4 100644
--- a/htdocs/includes/modules/member/cards/modules_cards.php
+++ b/htdocs/includes/modules/member/cards/modules_cards.php
@@ -77,7 +77,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
 	$dir = DOL_DOCUMENT_ROOT . "/includes/modules/member/cards/";
 
 	// Positionne modele sur le nom du modele a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->ADHERENT_CARDS_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/project/modules_project.php b/htdocs/includes/modules/project/modules_project.php
index 0ee01ca09ded18f2834418ffc9f64b4fa6f9b069..96c81aa4b617921aea65e6c5d39b94bb458b6f61 100644
--- a/htdocs/includes/modules/project/modules_project.php
+++ b/htdocs/includes/modules/project/modules_project.php
@@ -149,7 +149,7 @@ function project_pdf_create($db, $comid, $modele,$outputlangs)
 	$dir = DOL_DOCUMENT_ROOT."/includes/modules/project/pdf/";
 
 	// Positionne modele sur le nom du modele de projet a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if (! empty($conf->global->PROJECT_ADDON_PDF))
 		{
diff --git a/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php
index 832cff235a06d07015611fc59f43a3e52c9df75d..73e245e7556ce8650c64846319b6b3d83608b8fd 100644
--- a/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php
+++ b/htdocs/includes/modules/security/generate/modGeneratePassStandard.class.php
@@ -99,7 +99,7 @@ class modGeneratePassStandard extends ModeleGenPassword
 		{
 
 			// pick a random character from the possible ones
-			$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
+			$char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1);
 
 			// we don't want this character if it's already in the password
 			if (!strstr($password, $char))
@@ -120,7 +120,7 @@ class modGeneratePassStandard extends ModeleGenPassword
 	 */
 	function validatePassword($password)
 	{
-		if (strlen($password) < $this->length) return 0;
+		if (dol_strlen($password) < $this->length) return 0;
 		return 1;
 	}
 }
diff --git a/htdocs/includes/modules/societe/mod_codeclient_monkey.php b/htdocs/includes/modules/societe/mod_codeclient_monkey.php
index c0f28f12c7ca360f949dbb6d6163c9ba99c7f9bb..5c2249bcf2bbbc2cf4ea30e14b722f1e80757fa1 100644
--- a/htdocs/includes/modules/societe/mod_codeclient_monkey.php
+++ b/htdocs/includes/modules/societe/mod_codeclient_monkey.php
@@ -177,7 +177,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
 			}
 			else
 			{
-				if (strlen($code) == 0)
+				if (dol_strlen($code) == 0)
 				{
 					$result=-2;
 				}
@@ -235,7 +235,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
 	{
 		$res = 0;
 
-		if (strlen($code) < 11)
+		if (dol_strlen($code) < 11)
 		{
 			$res = -1;
 		}
diff --git a/htdocs/includes/modules/societe/modules_societe.class.php b/htdocs/includes/modules/societe/modules_societe.class.php
index 736f08cbe56da7d2233d7f86d710beff8507c1cb..8147c97596e7a56520d114f769878dc9d1444954 100644
--- a/htdocs/includes/modules/societe/modules_societe.class.php
+++ b/htdocs/includes/modules/societe/modules_societe.class.php
@@ -290,7 +290,7 @@ function thirdparty_doc_create($db, $id, $message, $modele, $outputlangs)
 	$srctemplatepath='';
 
 	// Positionne modele sur le nom du modele a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if ($conf->global->COMPANY_ADDON_PDF)
 		{
diff --git a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
index 2a05867993c4efabce2148425e7404968b214222..854b0a2f0ea3aa2ace712de88a15e1a1c6b1c2f8 100644
--- a/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
+++ b/htdocs/includes/modules/supplier_order/modules_commandefournisseur.php
@@ -148,7 +148,7 @@ function supplier_order_pdf_create($db, $comid, $modele,$outputlangs)
 	$dir = DOL_DOCUMENT_ROOT."/includes/modules/supplier_order/pdf/";
 
 	// Positionne modele sur le nom du modele de commande fournisseur a utiliser
-	if (! strlen($modele))
+	if (! dol_strlen($modele))
 	{
 		if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
 		{
diff --git a/htdocs/install/etape1.php b/htdocs/install/etape1.php
index 15b0dae5b9c84fb9f93cf8ec582640aa8bffb7a9..c848622dc685a54290651870f546825969d094db 100644
--- a/htdocs/install/etape1.php
+++ b/htdocs/install/etape1.php
@@ -54,15 +54,15 @@ $error = 0;
 $main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):'';
 
 // On supprime /  de fin dans main_dir
-if (substr($main_dir, strlen($main_dir) -1) == "/")
+if (substr($main_dir, dol_strlen($main_dir) -1) == "/")
 {
-	$main_dir = substr($main_dir, 0, strlen($main_dir)-1);
+	$main_dir = substr($main_dir, 0, dol_strlen($main_dir)-1);
 }
 
 // On supprime /  de fin dans main_url
-if (substr($_POST["main_url"], strlen($_POST["main_url"]) -1) == "/")
+if (substr($_POST["main_url"], dol_strlen($_POST["main_url"]) -1) == "/")
 {
-	$_POST["main_url"] = substr($_POST["main_url"], 0, strlen($_POST["main_url"])-1);
+	$_POST["main_url"] = substr($_POST["main_url"], 0, dol_strlen($_POST["main_url"])-1);
 }
 
 // Directory for generated documents (invoices, orders, ecm, etc...)
diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php
index c0caa20c7a761ac26fce50c21b54f1965565296f..9d8ee7f99121cd3c0868d3c1360c99bc70fd1dcf 100644
--- a/htdocs/install/etape2.php
+++ b/htdocs/install/etape2.php
@@ -151,7 +151,7 @@ if ($_POST["action"] == "set")
 		sort($tabledata);
 		foreach($tabledata as $file)
 		{
-			$name = substr($file, 0, strlen($file) - 4);
+			$name = substr($file, 0, dol_strlen($file) - 4);
 			$buffer = '';
 			$fp = fopen($dir.$file,"r");
 			if ($fp)
@@ -261,7 +261,7 @@ if ($_POST["action"] == "set")
 		sort($tabledata);
 		foreach($tabledata as $file)
 		{
-			$name = substr($file, 0, strlen($file) - 4);
+			$name = substr($file, 0, dol_strlen($file) - 4);
 			//print "<tr><td>Creation de la table $name</td>";
 			$buffer = '';
 			$fp = fopen($dir.$file,"r");
@@ -480,7 +480,7 @@ if ($_POST["action"] == "set")
 		sort($tabledata);
 		foreach($tabledata as $file)
 		{
-			$name = substr($file, 0, strlen($file) - 4);
+			$name = substr($file, 0, dol_strlen($file) - 4);
 			$fp = fopen($dir.$file,"r");
 			dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG);
 			if ($fp)
diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php
index 860a0ffaa1264194a76dc8d66762d2f0677daae3..1e01b6b62d9f4451565b69bcb46c5bd66df855a1 100644
--- a/htdocs/install/etape5.php
+++ b/htdocs/install/etape5.php
@@ -82,13 +82,13 @@ if ($_POST["action"] == "set")
 		exit;
 	}
 
-	if (strlen(trim($_POST["pass"])) == 0)
+	if (dol_strlen(trim($_POST["pass"])) == 0)
 	{
 		Header("Location: etape4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
 		exit;
 	}
 
-	if (strlen(trim($_POST["login"])) == 0)
+	if (dol_strlen(trim($_POST["login"])) == 0)
 	{
 		Header("Location: etape4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
 		exit;
diff --git a/htdocs/install/fileconf.php b/htdocs/install/fileconf.php
index 62f6d98c89be4a58a14dc159a4ebb6fcd5b277ea..b44c732a7b3a1ab981488f9ed7f7b43966c0e1c0 100644
--- a/htdocs/install/fileconf.php
+++ b/htdocs/install/fileconf.php
@@ -81,7 +81,7 @@ print '<td valign="top" class="label"><b>';
 print $langs->trans("WebPagesDirectory");
 print "</b></td>";
 
-if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
+if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0)
 {
     //print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"];
 
@@ -98,7 +98,7 @@ if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
     }
     else
     {
-        $dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
+        $dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
         // Nettoyage du path propose
         // Gere les chemins windows avec double "\"
         $dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root);
diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php
index 6bd1850fbc466631d468764d3d4ffe8d62eb233b..4964aaa787eb1efcbda89deb8ad71d8416ccba5c 100644
--- a/htdocs/install/repair.php
+++ b/htdocs/install/repair.php
@@ -183,7 +183,7 @@ if ($ok)
 		print '<tr><td nowrap>';
 		print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>';
 
-		$name = substr($file, 0, strlen($file) - 4);
+		$name = substr($file, 0, dol_strlen($file) - 4);
 
 		// Run sql script
 		$ok=run_sql($dir.$file, 0, '', 1);
diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php
index 684748429e43e53be79865a4d0fd7d2438aed67f..298edb43f2cf8612548fe02ac1a75a7840445151 100644
--- a/htdocs/install/upgrade.php
+++ b/htdocs/install/upgrade.php
@@ -322,7 +322,7 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
 			print '<tr><td nowrap>';
 			print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'."\n";
 
-			$name = substr($file, 0, strlen($file) - 4);
+			$name = substr($file, 0, dol_strlen($file) - 4);
 
 			// Run sql script
 			$ok=run_sql($dir.$file, 0, '', 1);
diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 87d35c5a1682941d93a6cc5e17ffd9d3d11cc02a..b2af2be5d8d7c6d206dd05f984338312e97cc498 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -2673,7 +2673,7 @@ function migrate_project_task_time($db,$langs,$conf)
 			{
 				$obj = $db->fetch_object($resql);
 
-				if ($obj->task_duration > 0 && strlen($obj->task_duration) < 3)
+				if ($obj->task_duration > 0 && dol_strlen($obj->task_duration) < 3)
 				{
 					$newtime = $obj->task_duration*60*60;
 
diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php
index 289b1fd14ca5e6f20104c71cea9dd8711d7354d4..e85e94915a73887c7e802c5fb83cdfd6cc1c9f15 100644
--- a/htdocs/lib/databases/mysql.lib.php
+++ b/htdocs/lib/databases/mysql.lib.php
@@ -253,10 +253,10 @@ class DoliDb
 	{
 		$version=	$this->getVersion();
 		$vlist=preg_split('/[.-]/',$version);
-		if (strlen($vlist[1])==1){
+		if (dol_strlen($vlist[1])==1){
 			$vlist[1]="0".$vlist[1];
 		}
-		if (strlen($vlist[2])==1){
+		if (dol_strlen($vlist[2])==1){
 			$vlist[2]="0".$vlist[2];
 		}
 		return $vlist[0].$vlist[1].$vlist[2];
diff --git a/htdocs/lib/databases/mysqli.lib.php b/htdocs/lib/databases/mysqli.lib.php
index 2133e460bbde5367b2a38c79f75c1bf035c65827..661e8dcc99ee5bb7444214288b1643b014d89c65 100644
--- a/htdocs/lib/databases/mysqli.lib.php
+++ b/htdocs/lib/databases/mysqli.lib.php
@@ -261,10 +261,10 @@ class DoliDb
 	{
 		$version=	$this->getVersion();
 		$vlist=preg_split('/[.-]/',$version);
-		if (strlen($vlist[1])==1){
+		if (dol_strlen($vlist[1])==1){
 			$vlist[1]="0".$vlist[1];
 		}
-		if (strlen($vlist[2])==1){
+		if (dol_strlen($vlist[2])==1){
 			$vlist[2]="0".$vlist[2];
 		}
 		return $vlist[0].$vlist[1].$vlist[2];
diff --git a/htdocs/lib/databases/pgsql.lib.php b/htdocs/lib/databases/pgsql.lib.php
index d17061e93fafd07f51f0da394a64c5f8e41544d5..28fcbd45ef27423c78824d5c94215920fb3b0ccf 100644
--- a/htdocs/lib/databases/pgsql.lib.php
+++ b/htdocs/lib/databases/pgsql.lib.php
@@ -376,10 +376,10 @@ class DoliDb
 	{
 		$version = $this->getVersion();
 		$vlist = preg_split('/[.-]/',$version);
-		if (strlen($vlist[1])==1){
+		if (dol_strlen($vlist[1])==1){
 			$vlist[1]="0".$vlist[1];
 		}
-		if (strlen($vlist[2])==1){
+		if (dol_strlen($vlist[2])==1){
 			$vlist[2]="0".$vlist[2];
 		}
 		return $vlist[0].$vlist[1].$vlist[2];
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index edeec47fc63378e251ac328cfea4857552f595b8..39d4c87e84442096a82097edf99ac7ff0eab4476 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -455,7 +455,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto
 	if ($format == 'dayhourxcard')      $format='%Y%m%dT%H%M%SZ';
 
 	// If date undefined or "", we return ""
-	if (strlen($time) == 0) return '';		// $time=0 allowed (it means 01/01/1970 00:00:00)
+	if (dol_strlen($time) == 0) return '';		// $time=0 allowed (it means 01/01/1970 00:00:00)
 
 	//print 'x'.$time;
 
@@ -845,22 +845,22 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
 	if (strtoupper($country) == "FR")
 	{
 		// France
-		if (strlen($phone) == 10) {
+		if (dol_strlen($phone) == 10) {
 			$newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2);
 		}
-		elseif (strlen($newphone) == 7)
+		elseif (dol_strlen($newphone) == 7)
 		{
 			$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2);
 		}
-		elseif (strlen($newphone) == 9)
+		elseif (dol_strlen($newphone) == 9)
 		{
 			$newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2);
 		}
-		elseif (strlen($newphone) == 11)
+		elseif (dol_strlen($newphone) == 11)
 		{
 			$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2);
 		}
-		elseif (strlen($newphone) == 12)
+		elseif (dol_strlen($newphone) == 12)
 		{
 			$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
 		}
@@ -2091,7 +2091,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
 	$return.= '<td class="nobordernopadding" valign="middle">';
 	$return.= '<div class="titre">'.$titre.'</div>';
 	$return.= '</td>';
-	if (strlen($mesg))
+	if (dol_strlen($mesg))
 	{
 		$return.= '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
 	}
@@ -2384,7 +2384,7 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1)
 	$end='';
 
 	// We increase nbdecimal if there is more decimal than asked (to not loose information)
-	if (strlen($decpart) > $nbdecimal) $nbdecimal=strlen($decpart);
+	if (dol_strlen($decpart) > $nbdecimal) $nbdecimal=dol_strlen($decpart);
 	// Si on depasse max
 	if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN)
 	{
@@ -2448,7 +2448,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
 			// We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10
 			$temps=sprintf("%0.10F",$amount-intval($amount));	// temps=0.0000000000 or 0.0000200000 or 9999.1000000000
 			$temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1
-			$nbofdec=max(0,strlen($temps)-2);	// -2 to remove "0."
+			$nbofdec=max(0,dol_strlen($temps)-2);	// -2 to remove "0."
 			$amount=number_format($amount,$nbofdec,$dec,$thousand);
 		}
 		//print "QQ".$amount.'<br>';
@@ -2469,7 +2469,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
 		elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
 		elseif ($rounding == '2')  $nbofdectoround=2; 	// For admin info page
 		//print "RR".$amount.' - '.$nbofdectoround.'<br>';
-		if (strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround);	// $nbofdectoround can be 0.
+		if (dol_strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround);	// $nbofdectoround can be 0.
 		else return 'ErrorBadParameterProvidedToFunction';
 		//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>';
 
@@ -2480,7 +2480,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
 			// We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10
 			$temps=sprintf("%0.10F",$amount-intval($amount));	// temps=0.0000000000 or 0.0000200000 or 9999.1000000000
 			$temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1
-			$nbofdec=max(0,strlen($temps)-2);	// -2 to remove "0."
+			$nbofdec=max(0,dol_strlen($temps)-2);	// -2 to remove "0."
 			$amount=number_format($amount,min($nbofdec,$nbofdectoround),$dec,$thousand);		// Convert amount to format with dolibarr dec and thousand
 		}
 		//print "TT".$amount.'<br>';
@@ -2984,7 +2984,7 @@ function dol_htmlentities($a,$b,$c)
  */
 function dol_string_is_good_iso($s)
 {
-	$len=strlen($s);
+	$len=dol_strlen($s);
 	$ok=1;
 	for($scursor=0;$scursor<$len;$scursor++)
 	{
@@ -3034,11 +3034,11 @@ function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8')
 	{
 		foreach ($a as $line)
 		{
-			if (strlen($line)>$maxlinesize)
+			if (dol_strlen($line)>$maxlinesize)
 			{
 				//$line_dec = html_entity_decode(strip_tags($line));
 				$line_dec = html_entity_decode($line);
-				if(strlen($line_dec)>$maxlinesize)
+				if(dol_strlen($line_dec)>$maxlinesize)
 				{
 					$line_dec=wordwrap($line_dec,$maxlinesize,'\n',true);
 					$nblines+=substr_count($line_dec,'\n');
@@ -3284,7 +3284,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive
  */
 function utf8_check($Str)
 {
-	for ($i=0; $i<strlen($Str); $i++)
+	for ($i=0; $i<dol_strlen($Str); $i++)
 	{
 		if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
 		elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
@@ -3294,7 +3294,7 @@ function utf8_check($Str)
 		elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
 		else return false; # Does not match any model
 		for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
-			if ((++$i == strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
+			if ((++$i == dol_strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
 			return false;
 		}
 	}
diff --git a/htdocs/lib/functions2.lib.php b/htdocs/lib/functions2.lib.php
index c1130beceabb5acb07f902e5bc32e25c672916e6..72c80b383090c39f992220f42ad736ea2328f8b7 100644
--- a/htdocs/lib/functions2.lib.php
+++ b/htdocs/lib/functions2.lib.php
@@ -368,7 +368,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 	$maskcounter=$reg[1];
 	$maskraz=-1;
 	$maskoffset=0;
-	if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
+	if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
 
 	// Extract value for third party mask counter
 	if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@@ -377,10 +377,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 		$maskrefclient_maskclientcode=$regClientRef[1];
 		$maskrefclient_maskcounter=$regClientRef[2];
 		$maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset
-		$maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask
-		$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
+		$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask
+		$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
 		$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
-		if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
+		if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
 	}
 	else $maskrefclient='';
 
@@ -388,8 +388,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 	if (preg_match('/\{(t+)\}/i',$mask,$regType))
 	{
 		$masktype=$regType[1];
-		$masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,strlen($regType[1]));//get n first characters of client code where n is length in mask
-		$masktype_value=str_pad($masktype_value,strlen($regType[1]),"#",STR_PAD_RIGHT);
+		$masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask
+		$masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT);
 	}
 	else $masktype='';
 
@@ -430,16 +430,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 		$yearoffset=0;
 		$yearcomp=0;
 		if (date("m",$date) < $maskraz) { $yearoffset=-1; }	// If current month lower that month of return to zero, year is previous year
-		if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
-		if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
-		if (strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
+		if (dol_strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
+		if (dol_strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
+		if (dol_strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
 
 		$sqlwhere='';
-		$sqlwhere.='( (SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp;
+		$sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp;
 		if ($monthcomp > 1)	// Test useless if monthcomp = 1 (or 0 is same as 1)
 		{
-			$sqlwhere.=' AND SUBSTRING('.$field.', '.(strlen($reg[1])+strlen($reg[2])+1).', '.strlen($reg[3]).') >= '.$monthcomp.')';
-			$sqlwhere.=' OR SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )';
+			$sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')';
+			$sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )';
 		}
 		else
 		{
@@ -451,7 +451,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 	// Define $sqlstring
 	$posnumstart=strpos($maskwithnocode,$maskcounter);	// Pos of counter in final string (from 0 to ...)
 	if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
-	$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.strlen($maskcounter).')';
+	$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
 	//print "x".$sqlstring;
 
 	// Define $maskLike
@@ -463,9 +463,9 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 	$maskLike = preg_replace('/\{y\}/i','_',$maskLike);
 	$maskLike = preg_replace('/\{mm\}/i','__',$maskLike);
 	$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
-	$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike);
-	if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
-	//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",strlen($masktype),"_"),$maskLike);
+	$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
+	if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
+	//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
 	if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
 
 	// Get counter in database
@@ -498,7 +498,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 		// Define $sqlstring
 		$maskrefclient_posnumstart=strpos($maskwithnocode,$maskrefclient_maskcounter,strpos($maskwithnocode,$maskrefclient));	// Pos of counter in final string (from 0 to ...)
 		if ($maskrefclient_posnumstart <= 0) return 'ErrorBadMask';
-		$maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.strlen($maskrefclient_maskcounter).')';
+		$maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.dol_strlen($maskrefclient_maskcounter).')';
 		//print "x".$sqlstring;
 
 		// Define $maskrefclient_maskLike
@@ -510,8 +510,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskrefclient_maskLike);
 		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskrefclient_maskLike);
 		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskrefclient_maskLike);
-		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskrefclient_maskLike);
-		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike);
+		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskrefclient_maskLike);
+		$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",dol_strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike);
 
 		// Get counter in database
 		$maskrefclient_counter=0;
@@ -522,7 +522,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 		$maskrefclient_sql.= " AND entity = ".$conf->entity;
 		if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
 		if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
-		$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
+		$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
 
 		dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
 		$maskrefclient_resql=$db->query($maskrefclient_sql);
@@ -548,7 +548,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 
 	// Now we replace the counter
 	$maskbefore='{'.$masktri.'}';
-	$maskafter=str_pad($counter,strlen($maskcounter),"0",STR_PAD_LEFT);
+	$maskafter=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT);
 	//print 'x'.$maskbefore.'-'.$maskafter.'y';
 	$numFinal = str_replace($maskbefore,$maskafter,$numFinal);
 
@@ -557,7 +557,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
 	{
 		//print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>";
 		$maskrefclient_maskbefore='{'.$maskrefclient.'}';
-		$maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT);
+		$maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,dol_strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT);
 		$numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal);
 	}
 
@@ -592,7 +592,7 @@ function check_value($mask,$value)
 	$maskcounter=$reg[1];
 	$maskraz=-1;
 	$maskoffset=0;
-	if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
+	if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
 
 	// Extract value for third party mask counter
 	if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@@ -601,10 +601,10 @@ function check_value($mask,$value)
 		$maskrefclient_maskclientcode=$regClientRef[1];
 		$maskrefclient_maskcounter=$regClientRef[2];
 		$maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset
-		$maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
-		$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
+		$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
+		$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
 		$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
-		if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
+		if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
 	}
 	else $maskrefclient='';
 
@@ -641,12 +641,12 @@ function check_value($mask,$value)
 	}
 	//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
 
-	// Check we have a number in ($posnumstart+1).', '.strlen($maskcounter)
+	// Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter)
 	//
 
 	// Check length
-	$len=strlen($maskwithnocode);
-	if (strlen($value) != $len) $result=-1;
+	$len=dol_strlen($maskwithnocode);
+	if (dol_strlen($value) != $len) $result=-1;
 
 	// Define $maskLike
 	$maskLike = dol_string_nospecial($mask);
@@ -657,7 +657,7 @@ function check_value($mask,$value)
 	$maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike);
 	$maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike);
 	$maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike);
-	$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike);
+	$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
 	if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
 
 
@@ -675,10 +675,10 @@ function check_value($mask,$value)
  */
 function binhex($bin, $pad=false, $upper=false)
 {
-	$last = strlen($bin)-1;
+	$last = dol_strlen($bin)-1;
 	for($i=0; $i<=$last; $i++){ $x += $bin[$last-$i] * pow(2,$i); }
 	$x = dechex($x);
-	if($pad){ while(strlen($x) < intval(strlen($bin))/4){ $x = "0$x"; } }
+	if($pad){ while(dol_strlen($x) < intval(dol_strlen($bin))/4){ $x = "0$x"; } }
 	if($upper){ $x = strtoupper($x); }
 	return $x;
 }
@@ -692,7 +692,7 @@ function binhex($bin, $pad=false, $upper=false)
 function hexbin($hexa)
 {
 	$bin='';
-	for($i=0;$i<strlen($hexa);$i++)
+	for($i=0;$i<dol_strlen($hexa);$i++)
 	{
 		$bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT);
 	}
diff --git a/htdocs/lib/functions_ch.lib.php b/htdocs/lib/functions_ch.lib.php
index dfc01bab9f5b7795843a3ec78ee7de1f50ea6d80..14ccac984d2dbf3a29ead1c2f8b54c6f9a5c5786 100644
--- a/htdocs/lib/functions_ch.lib.php
+++ b/htdocs/lib/functions_ch.lib.php
@@ -160,7 +160,7 @@ function dol_ch_controle_bvrb ($bvrb)
 
 	// Make control
 	$report=0;
-	while (strlen($bv)>1)
+	while (dol_strlen($bv)>1)
 	{
 		$match=substr($bv,0,1);
 		$report=$tableau[$report][$match];
diff --git a/htdocs/lib/google.class.php b/htdocs/lib/google.class.php
index 9762760307cec6abe1d359f0da40b2f0b53bca4f..08520dc84af5d40615799a30fca58cf006f44f2d 100644
--- a/htdocs/lib/google.class.php
+++ b/htdocs/lib/google.class.php
@@ -70,7 +70,7 @@ class GoogleAPI
 		//print $code;
 		//print "<br>";
 		$latitude = substr($code, 0, strpos($code, ","));
-		$longitude = substr($code, strpos($code, ",")+1, strlen(strpos($code, ","))-3);
+		$longitude = substr($code, strpos($code, ",")+1, dol_strlen(strpos($code, ","))-3);
 
 		// Output the coordinates
 		//echo "Longitude: $longitude ',' Latitude: $latitude";