[Solar-talk] Possible Solar_Sql_Row extends Solar_Struct toArray() bug?

Jeremy Cook jeremy1cook at gmail.com
Tue Sep 5 12:03:16 PDT 2006


Hi all,

I feel weird about the following behavior. It seems to me that an empty
array() should be returned instead of the array "array( [0] => )" in the
following example.

// Get the Users table.
$users // Get the user.
$output // When a matching handle is not found, toArray() does not simply return an
empty array.
printr($output); // array( [0] => )

I tracked what I see as a problem back to Solar_Struct::__construct() and
applied this solution:

    public function __construct($config     {
        parent::__construct($config);
        $this->_data     }

to this:

    public function __construct($config     {
        parent::__construct($config);
        if($this->_config['data'])
            $this->_data         else
            array();
    }

to fix the problem where $this->_config['data'] would be a boolean false and
would then get converted into array( [0] => ) instead of an empty array.

Is how it currently is the correct behavior, and should I just look for the
array( [0] => ) instead of an empty array? If not, is changing Solar_Struct
the best solution, or should the change be applied at the Solar_Sql_Row
level? Is there some other, better solution?

Thanks, Jeremy Cook
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.killersoft.com/pipermail/solar-talk/attachments/20060905/9732bb06/attachment.htm 


More information about the solar-talk mailing list