[imp] delhide change fails with PostgreSQL 7.3.4; IMP 3.2.2

Kari Whitcomb whitcomb at zk3.dec.com
Mon Feb 23 13:11:23 PST 2004


I attempted to file a bug report for this problem, but was having 
problems getting the necessary password, so I figured I submit the 
problem and solution here. Hopefully one of the developers can take the 
necessary action.

Using IMP 3.2.2 and PostgreSQL 7.3.4, when clicking 'Show Deleted' or 
'Hide Deleted' on the IMP Mailbox page, the following error appears on 
the resulting page (in addition to the change not taking affect):

    *A fatal error has occurred:*
    DB Error: unknown error
    [line 341 of /usr/opt/IAE620/usr/internet/horde/lib/Prefs/sql.php]
    Details have been logged for the administrator.

In addition the following error appears in the PostgreSQL log files:

    LOG: query: insert into horde_prefs (pref_uid, pref_scope, pref_name,
    pref_value) values('user at localhost', 'imp', 'delhide', TRUE)
    ERROR: column "pref_value" is of type text but expression is of type
    boolean
    You will need to rewrite or cast the expression

I've traced the problem into the mailbox.php code, line 245.  The value 
for 'delhide' is a boolean php values, so when the sql is written to 
sent to the server it outputs TRUE or FALSE instead of a string value in 
quotes which is the expected type of the pref_value field.  I'm not sure 
when the change in PostgreSQL took place, but more recent versions will 
not implicitly convert the boolean values to string, hence the error.

The fix is to make the following change to mailbox.php

245c245
<      $prefs->setValue('delhide', !$prefs->getValue('delhide'));
---
 >      $prefs->setValue('delhide', (string)!$prefs->getValue('delhide'));

This forces the delhide value to be a php string, so the sql command is 
written correctly.

Thanks,
Kari






More information about the imp mailing list