@@ -108,10 +108,10 @@ static int php_memc_list_entry(void) {
108
108
#define MEMC_VAL_COMPRESSION_ZLIB (1<<1)
109
109
#define MEMC_VAL_COMPRESSION_FASTLZ (1<<2)
110
110
111
- #define MEMC_VAL_GET_FLAGS (internal_flags ) ((internal_flags & MEMC_MASK_INTERNAL) >> 4)
112
- #define MEMC_VAL_SET_FLAG (internal_flags , internal_flag ) ((internal_flags) |= ((internal_flag << 4) & MEMC_MASK_INTERNAL))
113
- #define MEMC_VAL_HAS_FLAG (internal_flags , internal_flag ) ((MEMC_VAL_GET_FLAGS(internal_flags) & internal_flag) == internal_flag)
114
- #define MEMC_VAL_DEL_FLAG (internal_flags , internal_flag ) internal_flags &= ~((internal_flag << 4) & MEMC_MASK_INTERNAL)
111
+ #define MEMC_VAL_GET_FLAGS (internal_flags ) ((( internal_flags) & MEMC_MASK_INTERNAL) >> 4)
112
+ #define MEMC_VAL_SET_FLAG (internal_flags , internal_flag ) ((internal_flags) |= ((( internal_flag) << 4) & MEMC_MASK_INTERNAL))
113
+ #define MEMC_VAL_HAS_FLAG (internal_flags , internal_flag ) ((MEMC_VAL_GET_FLAGS(internal_flags) & ( internal_flag)) == ( internal_flag) )
114
+ #define MEMC_VAL_DEL_FLAG (internal_flags , internal_flag ) ( internal_flags &= ( ~((( internal_flag) << 4) & MEMC_MASK_INTERNAL)) )
115
115
116
116
/****************************************
117
117
User-defined flags
@@ -876,7 +876,8 @@ zend_bool s_compress_value (php_memc_compression_type compression_type, zend_str
876
876
}
877
877
878
878
/* This means the value was too small to be compressed, still a success */
879
- if (compressed_size > (ZSTR_LEN (payload ) * MEMC_G (compression_factor ))) {
879
+ if (ZSTR_LEN (payload ) <= (compressed_size * MEMC_G (compression_factor ))) {
880
+ MEMC_VAL_DEL_FLAG (* flags , MEMC_VAL_COMPRESSION_FASTLZ | MEMC_VAL_COMPRESSION_ZLIB );
880
881
efree (buffer );
881
882
return 1 ;
882
883
}
0 commit comments