php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58651 memcache_set fail with integer value
Submitted: 2009-04-27 13:30 UTC Modified: 2010-10-03 11:27 UTC
From: miksir at maker dot ru Assigned: hradtke (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
 [2009-04-27 13:30 UTC] miksir at maker dot ru
Description:
------------
Value not stored or stored but not received back.
pecl/memcache 3.0.4
memcached 1.2.6


Reproduce code:
---------------
correct:

$memcache_obj = memcache_connect('localhost', 11211);
memcache_set($memcache_obj, 'test123112', 'string', MEMCACHE_COMPRESSED, 30);
$ret = memcache_get($memcache_obj, 'test123112');
var_dump($ret);
string(6) "string"

uncorrect:
$memcache_obj = memcache_connect('localhost', 11211);
memcache_set($memcache_obj, 'test123112', 1, MEMCACHE_COMPRESSED, 30);
$ret = memcache_get($memcache_obj, 'test123112');
var_dump($ret);
bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-03 06:00 UTC] markus at opahle dot com
php throws an E_NOTICE:
PHP Notice:  MemcachePool::get(): Failed to uncompress data
 [2010-03-28 09:35 UTC] pierre dot php at gmail dot com
Can you try using trunk please? I can't reproduce it with memcache 1.2.8 and pecl's trunk (did not try using last release).
 [2010-03-28 09:41 UTC] pierre dot php at gmail dot com
or using the NON_BLOCKING_IO branch
 [2010-03-29 10:15 UTC] miksir at maker dot ru
test script:
<?php
error_reporting(E_ALL & E_STRICT);  
ini_set("display_errors", "stderr");
$memcache_obj = memcache_connect('10.55.1.6', 11211);
memcache_set($memcache_obj, 'test123112', 1, MEMCACHE_COMPRESSED, 30);
$ret = memcache_get($memcache_obj, 'test123112');
var_dump($ret);
?>

PHP 5.2.10
Tested on memcached 1.2.6 and memcached 1.4.4

pecl-memcache 3.0.2 test script result: string(1) "1"
server ~ # strace -e send,recv php membug_test.php 
send(3, "set test123112 0 10 1\r\n1\r\n", 26, 0) = 26
recv(3, "STORED\r\n", 32768, 0)         = 8
send(3, "get test123112\r\n", 16, 0)    = 16
recv(3, "VALUE test123112 0 1\r\n1\r\nEND\r\n", 32768, 0) = 30
string(1) "1"

pecl-memcache 3.0.4
pecl-memcache 3.0.5-dev ($Revision: 296729 $)
server ~ # strace -e send,recv php membug_test.php 
send(3, "set test123112 770 10 1\r\n1\r\n", 28, MSG_NOSIGNAL) = 28
recv(3, "STORED\r\n", 32768, 0)         = 8
send(3, "get test123112\r\n", 16, MSG_NOSIGNAL) = 16
recv(3, "VALUE test123112 770 1\r\n1\r\nEND\r\n", 32768, 0) = 32
bool(false)

If we disable compressing all work fine
- memcache_set($memcache_obj, 'test123112', 1, MEMCACHE_COMPRESSED, 30);
+ memcache_set($memcache_obj, 'test123112', 1, 0, 30);

pecl-memcache 3.0.5-dev ($Revision: 296729 $)
server ~ # strace -e send,recv php membug_test.php 
send(3, "set test123112 768 10 1\r\n1\r\n", 28, MSG_NOSIGNAL) = 28
recv(3, "STORED\r\n", 32768, 0)         = 8
send(3, "get test123112\r\n", 16, MSG_NOSIGNAL) = 16
recv(3, "VALUE test123112 768 1\r\n1\r\nEND\r\n", 32768, 0) = 32
int(1)
 [2010-09-30 06:04 UTC] vogel at folz dot de
Last week I hit this bug when testing Redhat RHEL-6 Beta.

I developed a patch that fixes this issue.  The patch can be
found in Redhat Bugzilla at https://bugzilla.redhat.com/show_bug.cgi?id=638892

Thank you all for your example scripts and previous research of this issue; both helped a lot to develop the fix.
 [2010-10-03 11:27 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-2019 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 09:01:25 2019 UTC