php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch 0001-Fix-bug-58585-Session-redundancy-doesn-t-work.patch for memcache Bug #58585

Patch version 2013-10-22 03:03 UTC

Return to Bug #58585 | Download this patch
Patch Revisions:

Developer: mattc@catalyst.net.nz

From f9a17bdb4514ebcd4eff33da4a87989260593673 Mon Sep 17 00:00:00 2001
From: Matt Clarkson <mattc@catalyst.net.nz>
Date: Tue, 22 Oct 2013 15:57:42 +1300
Subject: [PATCH 1/1] Fix bug #58585: Session redundancy doesn't work

An off-by-one bug meant that one fewer than the specified number of copies
of the session was being stored in the pool.
---
 memcache_session.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/memcache_session.c b/memcache_session.c
index f557853..b919b14 100644
--- a/memcache_session.c
+++ b/memcache_session.c
@@ -410,7 +410,7 @@ PS_WRITE_FUNC(memcache)
 				mmc_pool_release(pool, lockrequest);
 				continue;
 			}
-		} while (skip_servers.len < MEMCACHE_G(session_redundancy)-1 && skip_servers.len < pool->num_servers);
+		} while (skip_servers.len < MEMCACHE_G(session_redundancy) && skip_servers.len < pool->num_servers);
 
 		mmc_queue_free(&skip_servers);
 
@@ -501,7 +501,7 @@ PS_DESTROY_FUNC(memcache)
 				mmc_pool_release(pool, lockrequest);
 				continue;
 			}
-		} while (skip_servers.len < MEMCACHE_G(session_redundancy)-1 && skip_servers.len < pool->num_servers);
+		} while (skip_servers.len < MEMCACHE_G(session_redundancy) && skip_servers.len < pool->num_servers);
 
 		mmc_queue_free(&skip_servers);
 
-- 
1.8.4

 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC