Skip to content
This repository
Browse code

Fixed version check for a libmemcached bug in version 0.49 case #6

  • Loading branch information...
commit 5ff95162408c77d1d9b27f1f86740b58229e8e02 1 parent 817a9d5
Ilia Alshanetsky iliaal authored

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 4 php_memcached.c
8 php_memcached.c
@@ -2179,7 +2179,7 @@ static PHP_METHOD(Memcached, getOption)
2179 2179
2180 2180 result = memcached_callback_get(m_obj->memc, MEMCACHED_CALLBACK_PREFIX_KEY, &retval);
2181 2181 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
2183 2183 RETURN_STRINGL(result, strlen(result) - 1, 1);
2184 2184 #else
2185 2185 RETURN_STRING(result, 1);
@@ -2236,7 +2236,7 @@ static int php_memc_set_option(php_memc_t *i_obj, long option, zval *value TSRML
2236 2236 case MEMC_OPT_PREFIX_KEY:
2237 2237 {
2238 2238 char *key;
2239   -#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x00050000
  2239 +#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2240 2240 char tmp[MEMCACHED_PREFIX_KEY_MAX_SIZE - 1];
2241 2241 #endif
2242 2242 convert_to_string(value);
@@ -2244,10 +2244,10 @@ static int php_memc_set_option(php_memc_t *i_obj, long option, zval *value TSRML
2244 2244 key = NULL;
2245 2245 } else {
2246 2246 /*
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
2248 2248 character of the key prefix, to avoid the issue we pad it with a '0'
2249 2249 */
2250   -#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x00050000
  2250 +#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2251 2251 snprintf(tmp, sizeof(tmp), "%s0", Z_STRVAL_P(value));
2252 2252 key = tmp;
2253 2253 #else

0 comments on commit 5ff9516

Please sign in to comment.
Something went wrong with that request. Please try again.