Skip to content

Commit

Permalink
Fix LZF compression detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 4, 2024
1 parent c59f07c commit 49ba34a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/mutex/PHPRedisMutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function evalScript($redis, string $script, int $numkeys, array $argum
*/
private function hasLzfCompression($redis): bool
{
if (!\defined('Redis::COMPRESSION_LZF')) {
if (!\defined('Redis::COMPRESSION_LZF') || !extension_loaded('lzf')) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/mutex/PHPRedisMutexTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,14 @@ public static function provideSerializersAndCompressorsCases(): iterable
[\Redis::SERIALIZER_PHP, \Redis::COMPRESSION_NONE],
];

if (defined('Redis::SERIALIZER_IGBINARY')) {
if (defined('Redis::SERIALIZER_IGBINARY') && extension_loaded('igbinary')) {
$options[] = [
constant('Redis::SERIALIZER_IGBINARY'),
\Redis::COMPRESSION_NONE,
];
}

if (defined('Redis::COMPRESSION_LZF')) {
if (defined('Redis::COMPRESSION_LZF') && extension_loaded('lzf')) {
$options[] = [
\Redis::SERIALIZER_NONE,
constant('Redis::COMPRESSION_LZF'),
Expand All @@ -258,7 +258,7 @@ public static function provideSerializersAndCompressorsCases(): iterable
constant('Redis::COMPRESSION_LZF'),
];

if (defined('Redis::SERIALIZER_IGBINARY')) {
if (defined('Redis::SERIALIZER_IGBINARY') && extension_loaded('igbinary')) {
$options[] = [
constant('Redis::SERIALIZER_IGBINARY'),
constant('Redis::COMPRESSION_LZF'),
Expand Down

0 comments on commit 49ba34a

Please sign in to comment.