Select 1=1 instead of '1' when using get_var

Fixes #9102
This commit is contained in:
Mike Jolley 2015-09-10 16:49:51 +01:00
parent 8ec5986d48
commit 53c6bebbd0
2 changed files with 2 additions and 2 deletions

View File

@ -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 );
}
}

View File

@ -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",