From a843e1200db999b564abf48ef6cb51d7db7eb863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Thu, 24 Apr 2008 18:17:43 +0000 Subject: [PATCH] partially revert last change: stick to printf, but still allow variable number of arguments in error handlers we don't want to switch to strtr as ->raise() is used everywhere without arrays... --- bureau/class/m_err.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bureau/class/m_err.php b/bureau/class/m_err.php index d8b307ed..34100771 100644 --- a/bureau/class/m_err.php +++ b/bureau/class/m_err.php @@ -66,7 +66,8 @@ class m_err { if (_("err_".$clsid."_".$error)!="err_".$clsid."_".$error || is_string($error)) { $this->clsid=$clsid; $this->error=$error; - $this->param=$param; + $args = func_get_args(); + $this->param=array_slice($args, 2); $this->logerr(); return true; } else { @@ -90,10 +91,12 @@ class m_err { */ function errstr() { if (is_string($this->error)) { - $msg = strtr(_("err_".$this->clsid."_generic: ")._($this->error)."\n",$this->param); + $str = _("err_".$this->clsid."_generic: ")._($this->error)."\n"; } else { - $msg = strtr(_("err_".$this->clsid."_".$this->error)."\n",$this->param); + $str = _("err_".$this->clsid."_".$this->error)."\n"; } + $args = array_unshift($this->param, $str); + $msg = call_user_func_array("sprintf", $args); return $msg; }