[kronolith] Re: Category problems, undefined index.

Stephen Sherlock stevesherlock@es-net.co.uk
Thu Oct 24 21:38:24 2002


Chuck Hagenbuch wrote:


> Looks like your SQL data is invalid somehow. If you back up your data and
> start with an empty table, do the problems occur again?
> 
> -chuck

Yes.

I've also put a few lines of debugging code into the "Calendar->import" 
function, which seems to be the one giving me trouble.

The code now reads:

    function import($format, $data)
    {
        switch ($format) {
        case CATEGORY_FORMAT_FETCH:
echo "<br><br>Entered Switch:<br>";
            $cats = array();
            $cids = array();
            foreach ($data as $cat) {
                $cids[$cat[0]] = $cat[1];
                $cparents[$cat[0]] = $cat[2];
echo "cids[" . $cat[0] . "] = " . $cat[1] . " and cparents[" . $cat[0] . "] 
= " . $cat[2] . "<br>";
            }
            foreach ($cids as $id => $name) {

... etc

And thus, the debugging printout (on the horde main page, with only the 
kronolith summary displaying) looks like this:

Entered Switch:
cids[1] = kronolith and cparents[1] = 
cids[2] = shares and cparents[2] = :1
cids[9] = ste and cparents[9] = :1:2


Entered Switch:
cids[3] = kronolith and cparents[3] = 
cids[7] = ste and cparents[7] = :3:4
cids[10] = shares and cparents[10] = :3

Notice: Undefined index: 4 in /var/www/horde/lib/Category.php on line 470
 

Entered Switch:
cids[5] = kronolith and cparents[5] = 
cids[8] = ste and cparents[8] = :5:6
cids[11] = shares and cparents[11] = :5

 Notice: Undefined index: 6 in /var/www/horde/lib/Category.php on line 470
 

Remember, this was a completely clean install from CVS HEAD, all fresh 
database and everything. Since I'm only interested in relatively small 
installs for the time being, would a temporary fix include getting the 
function that calls this import function to pass the whole of the category 
table in with the "$data" variable, or would that overload the server 
beyond belief? I've not played with categories in a production system yet, 
so I've no idea how big that table can get...

Thanks for any advice,

Stephen Sherlock