I had to introduce a "nothrow" flag in the RedisSock object in order
to avoid throwing exceptions in the context of a session write.
When PHP finishes and closes the session, it doesn't consider exceptions
to be valid and simply bails out without giving the caller a chance to
catch it. I replaced zend_throw_exception with redis_throw_exception which
checks for this flag and just returns if we are in a session close context.