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,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.
|
||||||
|
|
Loading…
Reference in New Issue