Skip to content

Commit

Permalink
[Fix] Undefined array key 1, 2, 3 when using list to extract cookie v…
Browse files Browse the repository at this point in the history
…alues. (#38294)
  • Loading branch information
rrennick committed May 26, 2023
2 parents 2b12908 + 73c8b91 commit bf77b4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/pr-38294
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

add cart cookie validation
8 changes: 7 additions & 1 deletion plugins/woocommerce/includes/class-wc-session-handler.php
Expand Up @@ -292,7 +292,13 @@ public function get_session_cookie() {
return false;
}

list( $customer_id, $session_expiration, $session_expiring, $cookie_hash ) = explode( '||', $cookie_value );
$parsed_cookie = explode( '||', $cookie_value );

if ( count( $parsed_cookie ) < 4 ) {
return false;
}

list( $customer_id, $session_expiration, $session_expiring, $cookie_hash ) = $parsed_cookie;

if ( empty( $customer_id ) ) {
return false;
Expand Down

0 comments on commit bf77b4c

Please sign in to comment.