From 1017798c6cca68c6207aac6adef699f5b941131c Mon Sep 17 00:00:00 2001 From: Nicola Mustone Date: Tue, 11 Aug 2015 10:11:36 +0200 Subject: [PATCH 1/3] instroducing WC_Session::delete --- includes/abstracts/abstract-wc-session.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/includes/abstracts/abstract-wc-session.php b/includes/abstracts/abstract-wc-session.php index 2817f45d069..252583f5796 100644 --- a/includes/abstracts/abstract-wc-session.php +++ b/includes/abstracts/abstract-wc-session.php @@ -55,10 +55,7 @@ abstract class WC_Session { * @param mixed $key */ public function __unset( $key ) { - if ( isset( $this->_data[ $key ] ) ) { - unset( $this->_data[ $key ] ); - $this->_dirty = true; - } + $this->delete( $key ); } /** @@ -86,6 +83,18 @@ abstract class WC_Session { } } + /** + * Delete a session variable + * + * @param string $key + */ + public function delete( $key ) { + if ( isset( $this->_data[ $key ] ) ) { + unset( $this->_data[ $key ] ); + $this->_dirty = true; + } + } + /** * get_customer_id function. * From 6bc17c65c813eadaaebf9021d3e9f867e774a19d Mon Sep 17 00:00:00 2001 From: Nicola Mustone Date: Wed, 16 Sep 2015 11:34:03 +0200 Subject: [PATCH 2/3] delete to unset --- includes/abstracts/abstract-wc-session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/abstracts/abstract-wc-session.php b/includes/abstracts/abstract-wc-session.php index 252583f5796..5240813c6b0 100644 --- a/includes/abstracts/abstract-wc-session.php +++ b/includes/abstracts/abstract-wc-session.php @@ -88,7 +88,7 @@ abstract class WC_Session { * * @param string $key */ - public function delete( $key ) { + public function unset( $key ) { if ( isset( $this->_data[ $key ] ) ) { unset( $this->_data[ $key ] ); $this->_dirty = true; From 7d6bf488c95d7e3eae188b7a346f28f8c4967aed Mon Sep 17 00:00:00 2001 From: Nicola Mustone Date: Wed, 16 Sep 2015 11:34:22 +0200 Subject: [PATCH 3/3] using unset also in the magic method --- includes/abstracts/abstract-wc-session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/abstracts/abstract-wc-session.php b/includes/abstracts/abstract-wc-session.php index 5240813c6b0..3c815d8a16d 100644 --- a/includes/abstracts/abstract-wc-session.php +++ b/includes/abstracts/abstract-wc-session.php @@ -55,7 +55,7 @@ abstract class WC_Session { * @param mixed $key */ public function __unset( $key ) { - $this->delete( $key ); + $this->unset( $key ); } /**