php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
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 2.6.35.11-83.9.amzn1.x86_64 #1 SMP Sat Feb 19 23:42:04 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Testcontent: The first 512K of http://dumps.wikimedia.org/enwiki/latest/enwiki-latest-abstract1.xml

Compression:
[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:
---------------
<?php
$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/>
0
524288
593525

Actual result:
--------------
Server's version: 1.4.4<br/>
0
69237
138472


Patches

Pull Requests

History

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] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:43 UTC] cmb@php.net
The official bug tracker for PECL/memcache is now at
<https://github.com/websupport-sk/pecl-memcache/issues>.

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 22:01:31 2025 UTC