Hi everyone,
I'm trying to use Zend_Session with a Memcache-backend. It falls back
to DB if the cache is not available.
So far the backend works - I just got a problem with error-handling,
when the Memcache-Server(s) are not available.
And I think it might be connected to Zend_Session-code, although I
have to admit I don't understand php's error handling *completely*..
With an unavailable memcache-server registered, about every 10th
request the session-starting fails with the following message:
"Zend_Session_Exception: Zend_Session::start() - Memcache::get()
[function.Memcache-get]: foofoofoo.com (tcp 11211) failed with:
Connection failed (19928679) in
/Library/WebServer/Documents/stoodl/app/libs/Zend/Session.php on line
410"
This message comes from Zend_Session:403-411:
set_error_handler(array('Zend_Session_Exception',
'handleSessionStartError'), E_ALL);
session_start();
restore_error_handler();
if (Zend_Session_Exception::$sessionStartError !== null) {
set_error_handler(array('Zend_Session_Exception',
'handleSilentWriteClose'), E_ALL);
session_write_close();
restore_error_handler();
throw new Zend_Session_Exception(__CLASS__ . '::' .
__FUNCTION__ . '() - ' . Zend_Session_Exception::$sessionStartError);
}
So there's some own error-handling over the session_start()-method.
If I comment this out (line 403), no exception is thrown, and the
session is started properly.
So I think the memcache-message about the failed connection must be a
warning of some kind. Because the session-handler still correctly
falls back to the DB, and creates the session there, but the above
exception is thrown anyway..
Does somebody have an idea how I could get around that without
changing the Zend_Session-code?
I tried adding an "@" in front of where the session-backend calls
Zend_Cache::load()..
Do I understand correctly, that the "set_error_handler(..., E_ALL)"
means, that even warnings in "session_start()" are catched and an
exception is thrown? Is this the expected behavior?
I'd appreciate any feedback :)
Sincerely,
Reto Kaiser