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,8 +81,10 @@ abstract class WC_Session {
* @param mixed $value
*/
public function set( $key, $value ) {
$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
$this->_dirty = true;
if ( $value !== $this->get( $key ) ) {
$this->_data[ sanitize_key( $key ) ] = maybe_serialize( $value );
$this->_dirty = true;
}
}
/**