Skip to content

Fix issue #25 #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ if test "$PHP_MEMCACHED" != "no"; then

PHP_MEMCACHED_FILES="php_memcached.c fastlz/fastlz.c g_fmt.c"

AC_CHECK_LIB(memcached, memcached_server_major_version, AC_DEFINE(HAVE_MEMCACHED_SERVER_VERSION, 1, [Whether libmemcached have memcached_server_xxx_version functions]))

if test "$PHP_MEMCACHED_SESSION" != "no"; then
PHP_MEMCACHED_FILES="${PHP_MEMCACHED_FILES} php_memcached_session.c"
fi
Expand Down
6 changes: 6 additions & 0 deletions php_memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -2643,9 +2643,15 @@ static memcached_return php_memc_do_version_callback(const memcached_st *ptr, me

hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
version_len = snprintf(version, sizeof(version), "%d.%d.%d",
#ifdef HAVE_MEMCACHED_SERVER_VERSION
memcached_server_major_version(instance),
memcached_server_minor_version(instance),
memcached_server_micro_version(instance));
#else
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);
Expand Down