Check if already set before setting in WC_Session.

Prevents unintended dirty sessions. Fixes #6846
This commit is contained in:
Mike Jolley 2015-01-20 09:46:57 +00:00
parent 7f2a6b5e41
commit a494bf84de
1 changed files with 4 additions and 2 deletions

View File

@ -81,9 +81,11 @@ abstract class WC_Session {
* @param mixed $value * @param mixed $value
*/ */
public function set( $key, $value ) { public function set( $key, $value ) {
if ( $value !== $this->get( $key ) ) {
$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value ); $this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
$this->_dirty = true; $this->_dirty = true;
} }
}
/** /**
* get_customer_id function. * get_customer_id function.