Permalink
Browse files

Fix version access for libmemcached older than 1.0.8.

  • Loading branch information...
1 parent 09791df commit 74542111f175fe2ec41c8bf722fc2cd3dac93eea @andreiz andreiz committed Sep 30, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 php_memcached.c
View
@@ -2642,10 +2642,17 @@ static memcached_return php_memc_do_version_callback(const memcached_st *ptr, me
struct callbackContext* context = (struct callbackContext*) in_context;
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
+#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX >= 0x01000008
version_len = snprintf(version, sizeof(version), "%d.%d.%d",
memcached_server_major_version(instance),
memcached_server_minor_version(instance),
memcached_server_micro_version(instance));
+#else
+ version_len = snprintf(version, sizeof(version), "%d.%d.%d",
+ instance->major_version,
+ instance->minor_version,
+ instance->micro_version);
+#endif
add_assoc_stringl_ex(context->return_value, hostport, hostport_len+1, version, version_len, 1);
efree(hostport);

0 comments on commit 7454211

Please sign in to comment.