php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59260 3.0.4 cache delete bug
Submitted: 2010-06-12 00:48 UTC Modified: 2010-06-14 13:12 UTC
From: cindylinz at gmail dot com Assigned:
Status: Closed Package: memcache (PECL)
PHP Version: 5.2.12 OS: FreeBSD
Private report: No CVE-ID: None
 [2010-06-12 00:48 UTC] cindylinz at gmail dot com
Description:
------------
I've read the code at version 3.0.4.
I found that the expiration time is incorrectly assigned by value.

Though with the recent stable memcached (1.4.4), deleting
with expiration time seems not longer supported.
Memcached 1.4.4 will reject any delete command with
expiration.
With memcached 1.4.4, I think this patch is still need
to be applyed. Without this patch, value will never be deleted even when
I didn't assign positive expiration. Cause the original
version will always assign 1 as the expiration.

Thank you ^^



Reproduce code:
---------------
TEST CODE (with Memcached 1.4.4):
$memd = new Memcache;
$memd->connect("127.0.0.1", 11211);
$memd->set("test", "123");
$memd->delete("test");
$memd->connect("127.0.0.1", 11211);
echo $memd->get("test");
// I connect the cache server twice,
// forcing the client to get the data from server again.

PATCH:
--- memcache.c.old      2010-06-12 11:31:55.000000000 +0800
+++ memcache.c  2010-06-12 11:28:06.000000000 +0800
@@ -642,7 +642,7 @@
                        }

                        if (deleted) {
-                               pool->protocol->delete(request, request->key, request->key_len, value);
+                               pool->protocol->delete(request, request->key, request->key_len, exptime);
                        }
                        else {
                                pool->protocol->mutate(request, *key, request->key, request->key_len, invert ? -value : value, defval, defval_used, exptime);
@@ -676,7 +676,7 @@
                }

                if (deleted) {
-                       pool->protocol->delete(request, request->key, request->key_len, value);
+                       pool->protocol->delete(request, request->key, request->key_len, exptime);
                }
                else {
                        pool->protocol->mutate(request, keys, request->key, request->key_len, invert ? -value : value, defval, defval_used, exptime);


Expected result:
----------------
(empty)

Actual result:
--------------
123

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-14 13:12 UTC] hradtke@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 11:01:29 2024 UTC