a small bug in horde/lib/Prefs.php and the fix
Atif Ghaffar
aghaffar@developer.ch
Tue, 10 Apr 2001 06:38:57 +0200
Problem:
---------
I added a preference in prefs.php
--
$prefGroups['localzone'] = array(
'column' => _("Your Information"),
'label' => _("Local time zone"),
'desc' => _("Set the timezone for eminder notifications"),
'members' => array('localzone'));
and
$_prefs['localzone'] = array('value' => '+1',
'locked' => false,
'shared' => true,
'type' => 'special');
--
Now the first time I set this variable to my timezone, I get the
following error.
Warning: Undefined index: localzone in
/u1/usr/apache/htdocs/horde/lib/Prefs.php on line 312
and more of the same.
After the first time (once it is set) I can change and dont get this
error.
This happens with all new preferences that are not previously set.
Fix: just added a check to see if $this->prefs[$pref] isset.
--- Prefs.php Tue Apr 10 06:31:07 2001
+++ Prefs.php.atif Tue Apr 10 06:30:38 2001
@@ -309,7 +309,7 @@
* changing it. Changing it would set the "dirty" bit, causing
an
* unnecessary update later on in the storage routine.
*/
- if ($this->prefs[$pref]['val'] == $val) {
+ if (isset($this->prefs[$pref]) && $this->prefs[$pref]['val'] ==
$val) {
return true;
}
thanks
--
Atif Ghaffar
Internet Development Manager
4unet AG/SA/Ltd.
-------------------------.
+41 21 351 53 60 ¦ voice
+41 78 787 51 45 ¦ mobile
+41 86 0796598972¦ fax
http://www.4unet.net ¦ www
http://atif.developer.ch ¦ homepage
atif.ghaffar@4unet.net ¦ email