[dev] Turba problem with 'enum' attribute and posible fix

Sebastian Calero Laguia scalero at datadec.es
Tue Jun 17 10:23:55 PDT 2003


In the file "horde/lib/Form.php" (class Horde_Form) the function "&getType"
calls internally the php function 'call_user_func_array' passing the
variable "$params". The function 'call_user_func_array' is stripping the
array and passing its elements. In the case of  'enum' and possibly
'multienum' this is incorrect and we should pass a array in the $params
variable, not?

This is my fix proposal:

******  line 88 ******
    function &getType($type, $params = array())
    {
        $type_class = 'Horde_Form_Type_' . $type;
        if (!class_exists($type_class)) {
            Horde::fatal(PEAR::raiseError(sprintf('Inexistant class for
field type "%s"', $type)), __FILE__, __LINE__);
        }
        $type_ob = &new $type_class();
  ++  if ($type == 'enum') {
  ++      $params = array($params);
  ++  }
        call_user_func_array(array(&$type_ob, 'init'), $params);
        return $type_ob;
    }


Grettings...

Sebastian Calero
Datadec Online.



More information about the dev mailing list