From 26855e651b8be46f0f87f6a5905e36d6d46e3efa Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 25 Jun 2015 19:01:26 +0000 Subject: [PATCH] In `get_site_option()` and `get_option()`, ensure that `$notoptions` is an array before writing to it. Prevents a flood of `Cannot use a scalar value as an array`, because `$notoptions` is otherwise set to the result of `wp_cache_get()`, which returns `mixed`. Props hauvong. Fixes #31147. Built from https://develop.svn.wordpress.org/trunk@32943 git-svn-id: http://core.svn.wordpress.org/trunk@32914 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/option.php | 6 ++++++ wp-includes/version.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/wp-includes/option.php b/wp-includes/option.php index 5ba890ec6c..1157b56d94 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -83,6 +83,9 @@ function get_option( $option, $default = false ) { $value = $row->option_value; wp_cache_add( $option, $value, 'options' ); } else { // option does not exist, so we must cache its non-existence + if ( ! is_array( $notoptions ) ) { + $notoptions = array(); + } $notoptions[$option] = true; wp_cache_set( 'notoptions', $notoptions, 'options' ); @@ -1024,6 +1027,9 @@ function get_site_option( $option, $default = false, $use_cache = true ) { $value = maybe_unserialize( $value ); wp_cache_set( $cache_key, $value, 'site-options' ); } else { + if ( ! is_array( $notoptions ) ) { + $notoptions = array(); + } $notoptions[$option] = true; wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); diff --git a/wp-includes/version.php b/wp-includes/version.php index d02e80c802..f2a5715f5a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32942'; +$wp_version = '4.3-alpha-32943'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.