ZF-3226: Zend_Session_Exception much too vague

Issue Type: Improvement Created: 2008-05-08T13:33:52.000+0000 Last Updated: 2008-09-02T10:39:34.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: matt wiseman (mwiseman) Assignee: Ralph Schindler (ralph) Tags: - Zend_Session

Related issues: - ZF-1325



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:

<pre class="highlight">
     * handleSessionStartError() - interface for set_error_handler()
     * @see    <a href=""></a>
     * @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;


Posted by matt wiseman (mwiseman) on 2008-05-08T14:29:39.000+0000

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

Posted by matt wiseman (mwiseman) on 2008-05-08T14:35:30.000+0000

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.

Posted by matt wiseman (mwiseman) on 2008-05-08T15:06:12.000+0000

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

Posted by Wil Sinclair (wil) on 2008-06-09T11:59:47.000+0000

Please evaluate and fix/categorize as necessary.

Posted by Ralph Schindler (ralph) on 2008-08-06T22:18:55.000+0000

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

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:34.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.