From 9f98ee18b7b3c22b67435ecd9f788255633e6fe2 Mon Sep 17 00:00:00 2001
From: Erick Hitter <ehitter@gmail.com>
Date: Thu, 27 Feb 2014 11:32:39 -0800
Subject: [PATCH] Correct error in how additional global and non-persistent
 groups are added, which corrupted the arrays holding those groups.

In 868c0a8cd, I blindly copied two missing functions from another object caching plugin, not paying enough attention to how that plugin managed the data versus how this plugin does. As a result, the arrays of groups had some entries keyed by the group, others were unkeyed and the value represented the group.
---
 object-cache.php | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/object-cache.php b/object-cache.php
index 23ab4b8..d57774d 100644
--- a/object-cache.php
+++ b/object-cache.php
@@ -1071,8 +1071,7 @@ class WP_Object_Cache {
 	function add_global_groups( $groups ) {
 		$groups = (array) $groups;
 
-		$groups = array_fill_keys( $groups, true );
-		$this->global_groups = array_merge( $this->global_groups, $groups );
+		$this->global_groups = array_unique( array_merge( $this->global_groups, $groups ) );
 	}
 
 	/**
@@ -1083,7 +1082,6 @@ class WP_Object_Cache {
 	function add_non_persistent_groups( $groups ) {
 		$groups = (array) $groups;
 
-		$groups = array_fill_keys( $groups, true );
-		$this->no_redis_groups = array_merge( $this->no_redis_groups, $groups );
+		$this->no_redis_groups = array_unique( array_merge( $this->no_redis_groups, $groups ) );
 	}
 }
-- 
GitLab