From 2dc3e5b10454b0c04a936c8f4c7ff4f0fb9f5858 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 20 Jun 2014 16:20:39 +0200
Subject: [PATCH] Fix: [ bug #1471 ] Several PHP warnings when intercepting
 USER_CREATE trigger (Add a protection to avoid multiple errors).

---
 htdocs/core/class/translate.class.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php
index a7cabd9468d..c076cc3e874 100644
--- a/htdocs/core/class/translate.class.php
+++ b/htdocs/core/class/translate.class.php
@@ -345,6 +345,8 @@ class Translate
 	{
 		global $db;
 
+		if (! is_string($key)) return 'ErrorBadValueForParamNotAString';	// Avoid multiple errors with code not using function correctly.
+
 		//print 'xx'.$key;
 		$newstr=$key;
 		if (preg_match('/^Currency([A-Z][A-Z][A-Z])$/i',$key,$reg))
@@ -659,7 +661,7 @@ class Translate
 
         //print 'param: '.$key.'-'.$keydatabase.'-'.$this->trans($key); exit;
 
-		// Check if in language array (this can call getTradFromKey)
+		// Check if a translation is available (this can call getTradFromKey)
 		if ($this->transnoentitiesnoconv($key) != $key)
 		{
 			return $this->transnoentitiesnoconv($key);    // Found in language array
-- 
GitLab