From 8fc0d3693172fb2ca0662618011172122556096c Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Mon, 13 Dec 2010 20:04:06 +0000 Subject: [PATCH] Follow-up r66364: wincache fixes * Return the result of wincache_ucache_get() in get() * In command line mode $info['ucache_entries'] returned from wincache_ucache_info() is null, so don't iterate over a non-array --- includes/BagOStuff.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index 70a87a7789..6b933014e7 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -863,9 +863,11 @@ class WinCacheBagOStuff extends BagOStuff { * @return bool */ public function set( $key, $value, $expire = 0 ) { - wincache_ucache_set( $key, serialize( $value ), $expire ); + $result = wincache_ucache_set( $key, serialize( $value ), $expire ); - return true; + /* wincache_ucache_set returns an empty array on success if $value + was an array, bool otherwise */ + return ( is_array( $value ) && $result === array() ) || $result; } /** @@ -886,6 +888,10 @@ class WinCacheBagOStuff extends BagOStuff { $list = $info['ucache_entries']; $keys = array(); + if ( is_null( $list ) ) { + return array(); + } + foreach ( $list as $entry ) { $keys[] = $entry['key_name']; } -- 2.20.1