Skip to content

Commit

Permalink
Session handler: restore use of _table property, for consistency with…
Browse files Browse the repository at this point in the history
… other methods. (#44517)

* Restore use of _table property, for consistency with other methods.

* Ignore interpolated/unprepared variable warning (we're referencing a table name).
  • Loading branch information
barryhughes committed Feb 15, 2024
1 parent a5711d0 commit 94c0578
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix regression (and inconsistency) in the way the session handler references its database table.
3 changes: 2 additions & 1 deletion plugins/woocommerce/includes/class-wc-session-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ public function save_data( $old_session_key = 0 ) {

$wpdb->query(
$wpdb->prepare(
"INSERT INTO {$wpdb->prefix}woocommerce_sessions (`session_key`, `session_value`, `session_expiry`) VALUES (%s, %s, %d)
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
"INSERT INTO $this->_table (`session_key`, `session_value`, `session_expiry`) VALUES (%s, %s, %d)
ON DUPLICATE KEY UPDATE `session_value` = VALUES(`session_value`), `session_expiry` = VALUES(`session_expiry`)",
$this->_customer_id,
maybe_serialize( $this->_data ),
Expand Down

0 comments on commit 94c0578

Please sign in to comment.