diff --git a/config.m4 b/config.m4 index c1f793c..d84ff46 100644 --- a/config.m4 +++ b/config.m4 @@ -133,15 +133,20 @@ dnl Check for msgpack AC_MSG_CHECKING([for redis msgpack support]) if test "$PHP_REDIS_MSGPACK" != "no"; then - AC_MSG_RESULT([enabled]) - AC_DEFINE(HAVE_REDIS_MSGPACK,1,[Whether redis msgpack serializer is enabled]) - MSGPACK_INCLUDES="-I$msgpack_inc_path" - MSGPACK_EXT_DIR="$msgpack_inc_path/ext" - ifdef([PHP_ADD_EXTENSION_DEP], - [ - PHP_ADD_EXTENSION_DEP(redis, msgpack) - ]) - PHP_ADD_INCLUDE($MSGPACK_EXT_DIR) + msgpack_version=`grep -o 'PHP_MSGPACK_VERSION "[0-9\.]\+"' $msgpack_inc_path/ext/msgpack/php_msgpack.h | awk '{print $2}' | tr -d '"'` + if expr $msgpack_version "<" "2.0.3" > /dev/null; then + AC_MSG_ERROR([msgpack 2.0.3 or greater required]) + else + AC_MSG_RESULT([enabled]) + AC_DEFINE(HAVE_REDIS_MSGPACK,1,[Whether redis msgpack serializer is enabled]) + MSGPACK_INCLUDES="-I$msgpack_inc_path" + MSGPACK_EXT_DIR="$msgpack_inc_path/ext" + ifdef([PHP_ADD_EXTENSION_DEP], + [ + PHP_ADD_EXTENSION_DEP(redis, msgpack) + ]) + PHP_ADD_INCLUDE($MSGPACK_EXT_DIR) + fi else MSGPACK_INCLUDES="" AC_MSG_RESULT([disabled]) diff --git a/library.c b/library.c index ef7f579..ca48100 100644 --- a/library.c +++ b/library.c @@ -2245,14 +2245,7 @@ redis_unserialize(RedisSock* redis_sock, const char *val, int val_len, case REDIS_SERIALIZER_MSGPACK: #ifdef HAVE_REDIS_MSGPACK - /* - * Would like to be able to check to see if a string is msgpack'd (like with igbinary, below), - * but I don't believe there's an easy way to do that as there's no consistent header or - * other simple indication of packed-ness in msgpacked binary sequences, as far as I know. - */ - - php_msgpack_unserialize(z_ret, (char *)val, (size_t)val_len TSRMLS_CC); - ret = 1; + ret = !php_msgpack_unserialize(z_ret, (char *)val, (size_t)val_len TSRMLS_CC); #endif break;