|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59699 Compression Flag does not work as expected
Submitted: 2011-04-04 13:24 UTC Modified: 2021-03-25 16:43 UTC
From: leo dot buettiker at gmx dot ch Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 5.3.5 OS: GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: leo dot buettiker at gmx dot ch
New email:
PHP Version: OS:


 [2011-04-04 13:24 UTC] leo dot buettiker at gmx dot ch
I would expect content set with Memcache::set to be not compressed unless the flag MEMCACHE_COMPRESSED is set. But the content is always compressed.

Memcache Version:3.0.4
PHP Version: 5.3.6 (cli)(could not enter this version in bug tracking)
Memcached Server Version: 1.4.4
OS: Linux ip-10-58-149-116 #1 SMP Sat Feb 19 23:42:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Testcontent: The first 512K of

[ec2-user@ip-10-58-149-116 ~]$ ls -lh wiki.txt
-rw-rw-r-- 1 ec2-user ec2-user 512K Apr  4 16:54 wiki.txt
[ec2-user@ip-10-58-149-116 ~]$ gzip wiki.txt
[ec2-user@ip-10-58-149-116 ~]$ ls -lh wiki.txt.gz
-rw-rw-r-- 1 ec2-user ec2-user 68K Apr  4 16:54 wiki.txt.gz

Reproduce code:
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";

$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect 0

$memcache->set("wiki_uncompressed", file_get_contents("wiki.txt"), false, 360) or die ("Failed to save data at the server");
$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect ~524 288

$memcache->set("wiki_compressed", file_get_contents("wiki.txt"), MEMCACHE_COMPRESSED, 360) or die ("Failed to save data at the server");
$stat = $memcache->getStats();
echo $stat['bytes']."\n"; //expect less then 1 000 000

Expected result:
Server's version: 1.4.4<br/>

Actual result:
Server's version: 1.4.4<br/>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-04-04 14:00 UTC] leo dot buettiker at gmx dot ch
I upgraded now to Memcache Version 3.0.5, same here
 [2011-04-04 15:32 UTC] leo dot buettiker at gmx dot ch
Likely that this is only a documentation issue. As far as I understand the source code, memcache.compress_threshold is set to 20000 by default.
 [2021-03-25 16:43 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:43 UTC]
The official bug tracker for PECL/memcache is now at

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Apr 22 18:01:24 2021 UTC