From 53c6bebbd0c254ac3df74a8640fc6b327c595ebb Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 10 Sep 2015 16:49:51 +0100 Subject: [PATCH] Select 1=1 instead of '1' when using get_var Fixes #9102 --- includes/admin/class-wc-admin-post-types.php | 2 +- includes/updates/woocommerce-update-2.2.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php index 7a222cc6102..9c4cf18d00e 100644 --- a/includes/admin/class-wc-admin-post-types.php +++ b/includes/admin/class-wc-admin-post-types.php @@ -2221,7 +2221,7 @@ class WC_Admin_Post_Types { if ( apply_filters( 'woocommerce_process_product_file_download_paths_grant_access_to_new_file', true, $download_id, $product_id, $order ) ) { // grant permission if it doesn't already exist - if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1 FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $download_id ) ) ) { + if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1=1 FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $product_id, $download_id ) ) ) { wc_downloadable_file_permission( $download_id, $product_id, $order ); } } diff --git a/includes/updates/woocommerce-update-2.2.php b/includes/updates/woocommerce-update-2.2.php index cc9fb33e363..882a6860a1a 100644 --- a/includes/updates/woocommerce-update-2.2.php +++ b/includes/updates/woocommerce-update-2.2.php @@ -134,7 +134,7 @@ $attribute_taxonomies = $wpdb->get_results( "SELECT * FROM " . $wpdb->prefix . " foreach ( $attribute_taxonomies as $attribute_taxonomy ) { $sanitized_attribute_name = wc_sanitize_taxonomy_name( $attribute_taxonomy->attribute_name ); if ( $sanitized_attribute_name !== $attribute_taxonomy->attribute_name ) { - if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1 FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s;", $sanitized_attribute_name ) ) ) { + if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1=1 FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_name = %s;", $sanitized_attribute_name ) ) ) { // Update attribute $wpdb->update( "{$wpdb->prefix}woocommerce_attribute_taxonomies",