Problem/Motivation
Quoting from SessionHandler::write()
:
public function write($sid, $value) { // The exception handler is not active at this point, so we need to do it // manually. try { [...] return TRUE; } catch (\Exception $exception) { require_once DRUPAL_ROOT . '/core/includes/errors.inc'; // If we are displaying errors, then do so with no possibility of a // further uncaught exception being thrown. if (error_displayable()) { print '<h1>Uncaught exception thrown in session handler.</h1>'; print '<p>' . Error::renderExceptionSafe($exception) . '</p><hr />'; } return FALSE; } }
The comments are out of date, the exception handler is in place way before the session subsystem gets initialized. In addition it is preferable to let an exception fall through to the exception handler instead of attempting to render it into the (already finished) output because:
- The exception handler will try to properly log the exception
- The output might be of a different type than HTML
Proposed resolution
Remove the try...catch
.
Remaining tasks
Review.
User interface changes
None.
API changes
None.
Data model changes
None.
Beta phase evaluation
Issue category | Bug because the custom try...catch possibly clobbers non-HTML output and suppresses logging |
---|---|
Issue priority | Normal |