/**
  * Destructor
  *
  * stores errors in session
  *
  */
 public function __destruct()
 {
     if (isset($_SESSION)) {
         if (!isset($_SESSION['errors'])) {
             $_SESSION['errors'] = array();
         }
         if ($GLOBALS['cfg']['Error_Handler']['gather']) {
             // remember all errors
             $_SESSION['errors'] = array_merge($_SESSION['errors'], $this->errors);
         } 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;
                     break;
                 } else {
                     if ($error instanceof PMA_Error && !$error->isDisplayed()) {
                         $_SESSION['errors'][$key] = $error;
                     }
                 }
             }
         }
     }
 }
 /**
  * Destructor
  *
  * stores errors in session
  *
  */
 public function __destruct()
 {
     if (isset($_SESSION)) {
         if (!isset($_SESSION['errors'])) {
             $_SESSION['errors'] = array();
         }
         // 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.
              */
             if (count($_SESSION['errors']) >= 10) {
                 $error = new PMA_Error(0, __('Too many error messages, some are not displayed.'), __FILE__, __LINE__);
                 $_SESSION['errors'][$error->getHash()] = $error;
                 break;
             } else {
                 if ($error instanceof PMA_Error && !$error->isDisplayed()) {
                     $_SESSION['errors'][$key] = $error;
                 }
             }
         }
     }
 }