Issues

ZF-3226: Zend_Session_Exception much too vague

Description

Zend_Session_Exception is much too vague in its error reporting, what's more its stack trace will lead you to an entirely different area then where the bug, if any actually is. I ended up re-writing handleSessionStartError() to be more verbose and I ended up solving my problem in about 5 minutes, as opposed to the day I spent sorting through the backtrace. My fix is as follows (Feel free to modify the string construction to your tastes, but please keep all the data), and I highly recommend including this in the next official release as it will help alleviate developer headaches like the one I'm recovering from:


/**
     * handleSessionStartError() - interface for set_error_handler()
     *
     * @see    http://framework.zend.com/issues/browse/ZF-1325
     * @param  int    $errno
     * @param  string $errstr
     * @param  string $errfile
     * @param  int    $errline
     * @param  string $errcontext
     * @return void
     */
    static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext)
    {
        self::$sessionStartError = $errfile . '( Line:' . $errline . '): Error #' . $errno . ' ' . $errstr . ' ' . $errcontext;
    }


Comments

This is when this fix came into being, I appreciate that its part of a "hack" but it could still be more verbose

It should also be noted that this is only an issue due to implementation of this resulting in a completely askew stacktrace. A exception saying "An error happened" is ok if you've got good stacktrace telling you WHERE the aforementioned error happened. Due to how its being called however, the stack_trace is totally worthless for debugging, thus my additions of file and line. I realize we're not really compensating for a ZF issue so much as a php one, but I figure that anything that can be done to make error reporting more verbose is generally a good thing.

handleSilentWriteClose() should probably be modified in much the same way.

Please evaluate and fix/categorize as necessary.

Resolved at r10735 in trunk. Resolved at r10745 in release 1.6.

Updating for the 1.6.0 release.