Do not fail on errors stored in session

If there is user error stored in session, it would be treated as session
startup error, what is wrong.

Fixes #12229

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2016-05-23 17:15:23 +02:00
parent 00d73663b5
commit 66f774787f
3 changed files with 14 additions and 7 deletions

View File

@ -18,6 +18,7 @@ phpMyAdmin - ChangeLog
- issue #12192 Avoid storing full error data in session
- issue #12082 Fixed export of ARCHIVE tables with keys
- issue #11565 Add session reload for config authentication
- issue #12229 Do not fail on errors stored in session
4.6.1 (2016-05-02)
- issue #12120 PMA_Util not found in insert_edit.lib.php

View File

@ -80,11 +80,15 @@ class ErrorHandler
/**
* returns array with all errors
*
* @param $check bool Whether to check for session errors
*
* @return Error[]
*/
public function getErrors()
public function getErrors($check=true)
{
$this->checkSavedErrors();
if ($check) {
$this->checkSavedErrors();
}
return $this->errors;
}
@ -108,7 +112,7 @@ class ErrorHandler
*/
public function sliceErrors($count)
{
$errors = $this->getErrors();
$errors = $this->getErrors(false);
$this->errors = array_splice($errors, 0, $count);
return array_splice($errors, $count);
}
@ -385,11 +389,13 @@ class ErrorHandler
/**
* return count of errors
*
* @param $check bool Whether to check for session errors
*
* @return integer number of errors occurred
*/
public function countErrors()
public function countErrors($check=true)
{
return count($this->getErrors());
return count($this->getErrors($check));
}
/**

View File

@ -99,12 +99,12 @@ $session_name = 'phpMyAdmin';
// on first start of session we check for errors
// f.e. session dir cannot be accessed - session file not created
$orig_error_count = $GLOBALS['error_handler']->countErrors();
$orig_error_count = $GLOBALS['error_handler']->countErrors(false);
$session_result = session_start();
if ($session_result !== true
|| $orig_error_count != $GLOBALS['error_handler']->countErrors()
|| $orig_error_count != $GLOBALS['error_handler']->countErrors(false)
) {
setcookie($session_name, '', 1);
$errors = $GLOBALS['error_handler']->sliceErrors($orig_error_count);