Skip to content

Commit 348f274

Browse files
dictcpdick9gag
authored andcommitted
correct the compression_factor calculation
1 parent 2af9b61 commit 348f274

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

php_memcached.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,8 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
867867
}
868868

869869
/* This means the value was too small to be compressed, still a success */
870-
if (compressed_size > (ZSTR_LEN(payload) * MEMC_G(compression_factor))) {
870+
if (ZSTR_LEN(payload) < (compressed_size * MEMC_G(compression_factor))) {
871+
MEMC_VAL_DEL_FLAG(*flags, MEMC_VAL_COMPRESSED);
871872
efree (buffer);
872873
return 1;
873874
}

0 commit comments

Comments
 (0)