Changeset 2199

Show
Ignore:
Timestamp:
04/24/08 20:17:43 (3 weeks ago)
Author:
anarcat
Message:

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...

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/bureau/class/m_err.php

    r2198 r2199  
    6767      $this->clsid=$clsid; 
    6868      $this->error=$error; 
    69       $this->param=$param; 
     69      $args = func_get_args(); 
     70      $this->param=array_slice($args, 2); 
    7071      $this->logerr(); 
    7172      return true; 
     
    9192  function errstr() { 
    9293    if (is_string($this->error)) { 
    93       $msg = strtr(_("err_".$this->clsid."_generic: ")._($this->error)."\n",$this->param)
     94      $str = _("err_".$this->clsid."_generic: ")._($this->error)."\n"
    9495    } else { 
    95       $msg = strtr(_("err_".$this->clsid."_".$this->error)."\n",$this->param)
     96      $str = _("err_".$this->clsid."_".$this->error)."\n"
    9697    } 
     98    $args = array_unshift($this->param, $str); 
     99    $msg = call_user_func_array("sprintf", $args); 
    97100    return $msg; 
    98101  }