Skip to content

Commit b576ebe

Browse files
authored
update: tokenized ECE log on session mismatch (#10494)
1 parent 8ff692c commit b576ebe

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Significance: patch
2+
Type: update
3+
Comment: update: add debug to help with tokenized ECE session mismatch
4+
5+

includes/class-wc-payments-payment-request-session-handler.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ public function init() {
5151
$this->init_session_cookie();
5252

5353
if ( $this->_customer_id !== $this->_data['token_customer_id'] ) {
54+
\WCPay\Logger::error(
55+
sprintf(
56+
'Tokenized ECE cookie and session customer mismatch - customer: %s (%s) , session: %s (%s)',
57+
var_export( $this->_customer_id, true ), // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- should only be triggered when logging is enabled.
58+
gettype( $this->_customer_id ),
59+
var_export( $this->_data['token_customer_id'], true ), // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export -- should only be triggered when logging is enabled.
60+
gettype( $this->_data['token_customer_id'] )
61+
)
62+
);
63+
64+
// throwing an exception here to prevent further processing of the request.
5465
throw new Exception( __( 'Invalid token: cookie and session customer mismatch', 'woocommerce-payments' ) );
5566
}
5667

0 commit comments

Comments
 (0)