[Kolab-devel] Known issue? Kolab 3.0 webadmin "Internal error"

Chloé Desoutter chloe.desoutter at atasta.net
Thu Jul 11 13:53:06 CEST 2013


Greetings,

I just hunted down a nasty bug in the kolab-webadmin of 3.0 that 
prevented us from updating the schema.

I didn't find a ticket for it, so I report it here in the hope it will 
be useful.

in lib/api/kolab_api_service_type.php around line 190 there is a code 
snippet that's like it:

         $result = $this->db->query("UPDATE {$type}_types SET "
                     . implode(', ', $query) . " WHERE id = " . 
intval($postdata['id']));

         if (!result) {
             return false;
         }

This will always err out as $result is a non-query (an UPDATE), hence 
query will not return anything.

My proposed fix follows:

         $result = $this->db->query("UPDATE {$type}_types SET "
                     . implode(', ', $query) . " WHERE id = " . 
intval($postdata['id']));

         if (!$this->db->affected_rows()) {
             return false;
         }

It tests whether a row has been modified by the current query (it should 
have!) and if not, it errs out.

HtH

Sincerely yours
-- 
Chloé Desoutter
Directrice de production, ATASTA NET


More information about the devel mailing list