Skip to content

Commit 5ff9516

Browse files
committed
Fixed version check for a libmemcached bug in version 0.49 case #6
1 parent 817a9d5 commit 5ff9516

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

php_memcached.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,7 @@ static PHP_METHOD(Memcached, getOption)
21792179

21802180
result = memcached_callback_get(m_obj->memc, MEMCACHED_CALLBACK_PREFIX_KEY, &retval);
21812181
if (retval == MEMCACHED_SUCCESS && result) {
2182-
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x00050000
2182+
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX == 0x00049000
21832183
RETURN_STRINGL(result, strlen(result) - 1, 1);
21842184
#else
21852185
RETURN_STRING(result, 1);
@@ -2236,18 +2236,18 @@ static int php_memc_set_option(php_memc_t *i_obj, long option, zval *value TSRML
22362236
case MEMC_OPT_PREFIX_KEY:
22372237
{
22382238
char *key;
2239-
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x00050000
2239+
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX == 0x00049000
22402240
char tmp[MEMCACHED_PREFIX_KEY_MAX_SIZE - 1];
22412241
#endif
22422242
convert_to_string(value);
22432243
if (Z_STRLEN_P(value) == 0) {
22442244
key = NULL;
22452245
} else {
22462246
/*
2247-
work-around a bug in libmemcached prior to version 0.50 that truncates the trailing
2247+
work-around a bug in libmemcached in version 0.49 that truncates the trailing
22482248
character of the key prefix, to avoid the issue we pad it with a '0'
22492249
*/
2250-
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x00050000
2250+
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX == 0x00049000
22512251
snprintf(tmp, sizeof(tmp), "%s0", Z_STRVAL_P(value));
22522252
key = tmp;
22532253
#else

0 commit comments

Comments
 (0)