Force string comparison for customer_id

In 203dba5 a check against the current user id was introduced.

This check is always failing because of a type mismatch causing an unnecessary insert/update query against the database.
This commit is contained in:
Kris Shannon 2019-06-27 18:40:39 +10:00
parent 698625ce1d
commit 3945694e37
1 changed files with 3 additions and 3 deletions

View File

@ -93,8 +93,8 @@ class WC_Session_Handler extends WC_Session {
$this->_data = $this->get_session_data();
// If the user logs in, update session.
if ( is_user_logged_in() && get_current_user_id() !== $this->_customer_id ) {
$this->_customer_id = get_current_user_id();
if ( is_user_logged_in() && strval( get_current_user_id() ) !== $this->_customer_id ) {
$this->_customer_id = strval( get_current_user_id() );
$this->_dirty = true;
$this->save_data();
$this->set_customer_session_cookie( true );
@ -172,7 +172,7 @@ class WC_Session_Handler extends WC_Session {
$customer_id = '';
if ( is_user_logged_in() ) {
$customer_id = get_current_user_id();
$customer_id = strval( get_current_user_id() );
}
if ( empty( $customer_id ) ) {