From 7e190e496bb6946268515a2f7bdcf71ae01f97fa Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Tue, 3 Oct 2017 04:40:46 +0000 Subject: [PATCH] Multisite: Use `%s` when building query for `archived` sites in `WP_Site_Query`. In [25548], the `archived` column in `wp_blogs` was changed from `ENUM` to `TINYINT` to match other status fields. When `WP_Site_Query` was written later, it used `%d` as a placeholder when formatting the archived status. It is possible that this query will fail for any installations that did not update the schema for `wp_blogs` as only single quoted values are accepted for the `ENUM` type. In this case, `'0'` or `'1'` rather than `0` or `1`. We can work around this and support both `ENUM` and `TINYINT` in the query by using the `%s` placeholder and casting the value with `absint()`. Props stephdau. Fixes #38856. See #27832. Built from https://develop.svn.wordpress.org/trunk@41700 git-svn-id: http://core.svn.wordpress.org/trunk@41534 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-site-query.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php index 9fb051e90b..18140d1fdd 100644 --- a/wp-includes/class-wp-site-query.php +++ b/wp-includes/class-wp-site-query.php @@ -447,7 +447,7 @@ class WP_Site_Query { if ( is_numeric( $this->query_vars['archived'] ) ) { $archived = absint( $this->query_vars['archived'] ); - $this->sql_clauses['where']['archived'] = $wpdb->prepare( "archived = %d ", $archived ); + $this->sql_clauses['where']['archived'] = $wpdb->prepare( "archived = %s ", absint( $archived ) ); } if ( is_numeric( $this->query_vars['mature'] ) ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 98c8cbbab9..c64ac93761 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41699'; +$wp_version = '4.9-alpha-41700'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.