Check if already set before setting in WC_Session.
Prevents unintended dirty sessions. Fixes #6846
This commit is contained in:
parent
7f2a6b5e41
commit
a494bf84de
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue