Skip to content

Commit

Permalink
Fixed issue with unintentional flashdata
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tswagger committed May 7, 2015
1 parent a4726f2 commit 5ff1af1
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions application/libraries/Aauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1664,7 +1683,8 @@ public function set_as_read_pm($pm_id){
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);
}
}

Expand Down Expand Up @@ -1739,7 +1759,8 @@ public function info($message = '', $flashdata = false){

$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);
}
}

Expand Down

0 comments on commit 5ff1af1

Please sign in to comment.