From 5ff1af124c7dd2f33923efdd668f0376333ff781 Mon Sep 17 00:00:00 2001 From: tswagger Date: Thu, 7 May 2015 10:51:13 -0500 Subject: [PATCH] Fixed issue with unintentional flashdata Fixed bug where as adding an error or info to flash data would result in all errors/infos being added to the flash data. Two temporary arrays were used to store current flash data and are used to update the flash data correctly as errors/info are added to flash data. --- application/libraries/Aauth.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/application/libraries/Aauth.php b/application/libraries/Aauth.php index a0b5dc3..33841e1 100644 --- a/application/libraries/Aauth.php +++ b/application/libraries/Aauth.php @@ -53,6 +53,25 @@ class Aauth { * @var array */ public $infos = array(); + + /** + * Local temporary storage for current flash errors + * + * Used to update current flash data list since flash data is only available on the next page refresh + * @access public + * var array + */ + public $flash_errors = array(); + + /** + * Local temporary storage for current flash infos + * + * Used to update current flash data list since flash data is only available on the next page refresh + * @access public + * var array + */ + public $flash_infos = array(); + ######################## # Base Functions @@ -1664,7 +1683,8 @@ class Aauth { public function error($message = '', $flashdata = false){ $this->errors[] = $message; if($flashdata) { - $this->CI->session->set_flashdata('errors', $this->errors); + $this->flash_errors[] = $message; + $this->CI->session->set_flashdata('errors', $this->flash_errors); } } @@ -1739,7 +1759,8 @@ class Aauth { $this->infos[] = $message; if($flashdata) { - $this->CI->session->set_flashdata('infos', $this->infos); + $this->flash_infos[] = $message; + $this->CI->session->set_flashdata('infos', $this->flash_infos); } }