diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-11-08 04:15:22 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-11-08 04:15:22 +0300 |
commit | 19c40eec41497b9496c2906aed356556f01b61f3 (patch) | |
tree | f6b7c511bd75afb80e366b4695db025428c16b20 /libs | |
parent | f1d6cc7618221813699c0f8c0d97e5c41c48d323 (diff) |
Better detection of a succesfull start of a session (#15114)
* Better detection of a succesfull start of a session
Differentiate between errors and warnings in session error handler and only assume session was not started if there was an error triggered. It should not throw an exception if there was only a notice or a warning.
* Update Session.php
Diffstat (limited to 'libs')
-rw-r--r-- | libs/Zend/Session.php | 4 | ||||
-rw-r--r-- | libs/Zend/Session/Exception.php | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/libs/Zend/Session.php b/libs/Zend/Session.php index 38c8a1ba86..73668507aa 100644 --- a/libs/Zend/Session.php +++ b/libs/Zend/Session.php @@ -479,14 +479,14 @@ class Zend_Session extends Zend_Session_Abstract restore_error_handler(); } - if (!$startedCleanly || Zend_Session_Exception::$sessionStartError != null) { + if (!$startedCleanly || !empty(Zend_Session_Exception::$sessionStartError)) { if (self::$_throwStartupExceptions) { set_error_handler(array('Zend_Session_Exception', 'handleSilentWriteClose'), $errorLevel); } session_write_close(); if (self::$_throwStartupExceptions) { restore_error_handler(); - throw new Zend_Session_Exception(__CLASS__ . '::' . __FUNCTION__ . '() - ' . Zend_Session_Exception::$sessionStartError); + throw new Zend_Session_Exception(__CLASS__ . '::' . __FUNCTION__ . '() - ' . Zend_Session_Exception::$sessionStartError . ' Warnings: ' . Zend_Session_Exception::$sessionStartWarning); } } } diff --git a/libs/Zend/Session/Exception.php b/libs/Zend/Session/Exception.php index 734e2c45f9..b1ce8fc6ac 100644 --- a/libs/Zend/Session/Exception.php +++ b/libs/Zend/Session/Exception.php @@ -43,7 +43,8 @@ class Zend_Session_Exception extends Zend_Exception * @see http://framework.zend.com/issues/browse/ZF-1325 * @var string PHP Error Message */ - static public $sessionStartError = null; + static public $sessionStartError = ''; + static public $sessionStartWarning = ''; /** * handleSessionStartError() - interface for set_error_handler() @@ -55,10 +56,12 @@ class Zend_Session_Exception extends Zend_Exception */ static public function handleSessionStartError($errno, $errstr, $errfile, $errline, $errcontext) { - if (!isset(self::$sessionStartError)) { - self::$sessionStartError = ''; + $message = $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr; + if (E_ERROR === $errno || E_CORE_ERROR === $errno || E_COMPILE_ERROR === $errno) { + self::$sessionStartError .= $message . ' '; + } else { + self::$sessionStartWarning .= $message . ' '; } - self::$sessionStartError .= $errfile . '(Line:' . $errline . '): Error #' . $errno . ' ' . $errstr . ' '; } /** |