Error upon Horde login of specific users due to preference corruption


Published on January 05, 2014 by Marcus Rickert

Horde Php Bugfix

1 min READ

After an upgrade of Horde (unfortunately, I do not remember which one), I had trouble with some of my Horde users. Upon login, I received the error message

Ein schwerer Fehler ist aufgetreten:
Horde_Prefs_Scope::serialize() must return a string or NULL
Details wurden für den Administrator mitgeloggt.

which hinted at some problem with the preferences for these users. After the error I had to either delete all cookies related to Horde or (in my case simpler) delete all cookies of the browser to login as ANY other user, even for as those that actually still worked!

I found out that it is sufficient to delete all Horde preferences of the corrupted user relating to scope horde to fix the problem.

Of course, the Horde settings will have to be reconfigured manually afterwards!

The following two little scripts can be used to selectively delete the preferences for one user given as parameter to the shell script.

#! /bin/bash
horde_uid=$1
sql_script="/etc/horde4/horde/delete_prefs.mysql"
echo "Deleting preferences for user $horde_uid"
mysql -u horde -p -A -e "set @horde_uid=\"${horde_uid}\"; source ${sql_script};"

This is the script delete_prefs.mysql.

DELETE FROM `horde`.`horde_prefs` 
 WHERE `horde_prefs`.`pref_uid` = @horde_uid 
   AND `horde_prefs`.`pref_scope` = 'horde';