Make WordPress Core

Changeset 32943


Ignore:
Timestamp:
06/25/2015 07:00:51 PM (9 years ago)
Author:
wonderboymusic
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/option.php

    r32613 r32943  
    8484                    wp_cache_add( $option, $value, 'options' );
    8585                } else { // option does not exist, so we must cache its non-existence
     86                    if ( ! is_array( $notoptions ) ) {
     87                         $notoptions = array();
     88                    }
    8689                    $notoptions[$option] = true;
    8790                    wp_cache_set( 'notoptions', $notoptions, 'options' );
     
    10251028                wp_cache_set( $cache_key, $value, 'site-options' );
    10261029            } else {
     1030                if ( ! is_array( $notoptions ) ) {
     1031                     $notoptions = array();
     1032                }
    10271033                $notoptions[$option] = true;
    10281034                wp_cache_set( $notoptions_key, $notoptions, 'site-options' );
Note: See TracChangeset for help on using the changeset viewer.