From 2c4e79edc04f566bd3ee45b35cae0f80da8f511f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 14 Dec 2011 18:02:30 +0100 Subject: [PATCH] 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. --- libraries/Error_Handler.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libraries/Error_Handler.class.php b/libraries/Error_Handler.class.php index 8f14c08de6..fb3968f966 100644 --- a/libraries/Error_Handler.class.php +++ b/libraries/Error_Handler.class.php @@ -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; }