[horde] Error on the login page while using a hook

Gilbert, Marie-Christine Marie-Christine.Gilbert at microcell.ca
Fri Oct 18 08:49:34 PDT 2002


Hi there,

I'm having a problem with a hook(for the pref "from_addr") that I have
defined. We are using the HEAD version(dated 2002/10/09) of HORDE and we are
also using the authentication by application (the application is IMP).

I think that my hook is defined correctly. I have added a hook attribute in
the config file(hook=>'true' in prefs.php).
I have also defined the hook function in hooks.php (function
_prefs_hook_from_addr()).

My hook seems to work well except that we get this error when accessing the
IMP login page:
"Notice: Undefined index: from_addr in
/home/httpd/imp/horde-head/lib/Prefs.php on line 452
Warning: Cannot add header information - headers already sent by (output
started at /home/httpd/imp/horde-head/lib/Prefs.php:452) in
/home/httpd/imp/horde-head/lib/Secret.php on line 104".

Even if we get this error, we are able to log into IMP.

We have looked through the source to try to find out what is causing that
error.

These are all the functions that we traced into during our investigation:
In /imp/login.php there's a call to $registry->loadPrefs();
In horde/lib/Registry.php(function loadPrefs) there's a call to
$prefs->retrieve();
In horde/lib/Prefs/sql.php(function retrieve) there's a call to
$this->_callHooks();
In horde/lib/Prefs.php(function _callHooks) there's a call to
$this->_setValue($pref, $func());

Finally, in the _setValue(Prefs.php) function we discovered that
"$this->_prefs[$pref]['val']" is called but it has not been initialized yet.
We have added that little piece of code in the _setValue(Prefs.php) function
to initialize the variable and it seems to work.

	  if (!array_key_exists($pref, $this->_prefs)) {
		$this->_prefs[$pref]['val'] = $val;
		$this->_prefs[$pref]['mask'] = 0;
	  } else {
            if(($this->_prefs[$pref]['val'] == $val) &&
!$this->isDefault($pref)) {
		    return true;
	       }
        }

Is that a bug or it's only because I did something wrong somewhere?

Thanks a lot for your help




More information about the horde mailing list