Skip to content

Commit 86fb158

Browse files
committed
~ Fix security handle_params_query_list_orders
1 parent ecab3e1 commit 86fb158

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

inc/order/class-lp-order.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ public static function get_order_statuses(): array {
15061506
* @return void
15071507
* @throws Exception
15081508
* @since 4.3.2.8
1509-
* @version 1.0.1
1509+
* @version 1.0.2
15101510
*/
15111511
public static function handle_params_query_list_orders( PostFilter &$post_filter, array $param = array() ) {
15121512
$post_db = PostDB::getInstance();
@@ -1531,7 +1531,7 @@ public static function handle_params_query_list_orders( PostFilter &$post_filter
15311531
'post_title',
15321532
'post_author',
15331533
'post_status',
1534-
'order_total'
1534+
'order_total',
15351535
);
15361536
if ( ! in_array( $order_by, $allowed_key ) ) {
15371537
$order_by = 'ID';
@@ -1580,10 +1580,16 @@ public static function handle_params_query_list_orders( PostFilter &$post_filter
15801580

15811581
if ( ! empty( $month ) ) {
15821582
$year = substr( $month, 0, 4 );
1583-
$post_filter->where[] = "AND YEAR(p.post_date) = $year";
1583+
$post_filter->where[] = $post_db->wpdb->prepare(
1584+
'AND YEAR(p.post_date) = %s',
1585+
$year
1586+
);
15841587
if ( strlen( $month ) > 5 ) {
15851588
$mon = substr( $month, 4, 2 );
1586-
$post_filter->where[] = "AND MONTH(p.post_date) = $mon";
1589+
$post_filter->where[] = $post_db->wpdb->prepare(
1590+
'AND MONTH(p.post_date) = %s',
1591+
$mon
1592+
);
15871593
}
15881594
}
15891595

0 commit comments

Comments
 (0)