[hermes]array_keys error

Marc G. Fournier scrappy@hub.org
Wed Oct 30 15:13:41 2002


On Wed, 30 Oct 2002, Chuck Hagenbuch wrote:

> Quoting "Marc G. Fournier" <scrappy@hub.org>:
>
> > Warning: First argument to array_keys() should be an array in
> > /usr/local/www/demo.hub.org/horde/lib/Form.php on line 68
>
> Before I waste half an hour blindly clicking, want to tell me on what page
> and how you get this error?

ack, sorry ... just click on 'Time-Tracking', its the first error at the
top of hte page ... had one person comment about it to me on the demo
site, as he's seeing the same thing and figured it was an error on his
side ... it may still be 'operator error', but i can't seem to find where
...

The function in Form.php is:

    function &addVariable($humanName, $varName, &$type, $required,
                          $readonly = false, $description = null)
    {
        $var = new Horde_Form_Variable($humanName, $varName, $type,
                                         $required, $readonly, $description);
        if ($var->getTypeName() == 'enum' &&
            count($var->getValues()) == 1) {
            $vals = array_keys($var->getValues());
            $this->_vars->addVar($var->varName, $vals[0]);
        }
        $idx = array_push($this->_variables, $var);
        return $this->_variables[$idx - 1];
    }