Do not store too many error messages in session

In case of some bug in our code (like missing flags on fields meta in
mysql DBI), the session would explode to huge size (hundreths of
megabytes). Now we limit number of messages to store to 20 (what should
be more than enough for regular usage). Developers still should have
$GLOBALS['cfg']['Error_Handler']['gather'] enabled and will get all
errors.
This commit is contained in:
Michal Čihař 2011-12-14 18:02:30 +01:00
parent b8522b5e1a
commit 2c4e79edc0

View File

@ -53,6 +53,15 @@ class PMA_Error_Handler
} else {
// remember only not displayed errors
foreach ($this->_errors as $key => $error) {
/**
* We don't want to store all errors here as it would explode user
* session. In case you want them all set
* $GLOBALS['cfg']['Error_Handler']['gather'] to true
*/
if (count($_SESSION['errors']) >= 20) {
$error = new PMA_Error(0, __('Too many error messages, some are not displayed.'), __FILE__, __LINE__);
$_SESSION['errors'][$error->getHash()] = $error;
}
if (($error instanceof PMA_Error) && ! $error->isDisplayed()) {
$_SESSION['errors'][$key] = $error;
}