Known issue? Kolab 3.0 webadmin "Internal error"

Chloé Desoutter <[email protected]>
Newsgroups gmane.comp.kde.devel.kolab
Message-ID <51DE9CA2.9070805__20304.4797912755$1373543612$gmane$org@atasta.net>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.