Changeset 42833
- Timestamp:
- 03/13/2018 03:36:14 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/option.php
r42655 r42833 1248 1248 $notoptions = wp_cache_get( $notoptions_key, 'site-options' ); 1249 1249 1250 if ( is set( $notoptions[ $option ] ) ) {1250 if ( is_array( $notoptions ) && isset( $notoptions[ $option ] ) ) { 1251 1251 1252 1252 /** … … 1294 1294 } 1295 1295 } 1296 } 1297 1298 if ( ! is_array( $notoptions ) ) { 1299 $notoptions = array(); 1300 wp_cache_set( $notoptions_key, $notoptions, 'site-options' ); 1296 1301 } 1297 1302 -
trunk/tests/phpunit/tests/option/networkOption.php
r42343 r42833 122 122 ); 123 123 } 124 125 /** 126 * @ticket 43506 127 */ 128 public function test_get_network_option_sets_notoptions_if_option_found() { 129 $network_id = get_current_network_id(); 130 $notoptions_key = "$network_id:notoptions"; 131 132 $original_cache = wp_cache_get( $notoptions_key, 'site-options' ); 133 if ( false !== $original_cache ) { 134 wp_cache_delete( $notoptions_key, 'site-options' ); 135 } 136 137 // Retrieve any existing option. 138 get_network_option( $network_id, 'site_name' ); 139 140 $cache = wp_cache_get( $notoptions_key, 'site-options' ); 141 if ( false !== $original_cache ) { 142 wp_cache_set( $notoptions_key, $original_cache, 'site-options' ); 143 } 144 145 $this->assertSame( array(), $cache ); 146 } 147 148 /** 149 * @ticket 43506 150 */ 151 public function test_get_network_option_sets_notoptions_if_option_not_found() { 152 $network_id = get_current_network_id(); 153 $notoptions_key = "$network_id:notoptions"; 154 155 $original_cache = wp_cache_get( $notoptions_key, 'site-options' ); 156 if ( false !== $original_cache ) { 157 wp_cache_delete( $notoptions_key, 'site-options' ); 158 } 159 160 // Retrieve any non-existing option. 161 get_network_option( $network_id, 'this_does_not_exist' ); 162 163 $cache = wp_cache_get( $notoptions_key, 'site-options' ); 164 if ( false !== $original_cache ) { 165 wp_cache_set( $notoptions_key, $original_cache, 'site-options' ); 166 } 167 168 $this->assertSame( array( 'this_does_not_exist' => true ), $cache ); 169 } 124 170 }
Note: See TracChangeset
for help on using the changeset viewer.