@@ -452,7 +452,7 @@ static PHP_METHOD(Memcached, __construct)
452452 if (plist_key ) {
453453 efree (plist_key );
454454 }
455- #if HAVE_LIBMEMCACHED_CHECK_CONFIGURATION
455+ #ifdef HAVE_LIBMEMCACHED_CHECK_CONFIGURATION
456456 if (libmemcached_check_configuration (conn_str , conn_str_len , error_buffer , sizeof (error_buffer )) != MEMCACHED_SUCCESS ) {
457457 php_error_docref (NULL TSRMLS_CC , E_ERROR , "configuration error %s" , error_buffer );
458458 } else {
@@ -1159,7 +1159,7 @@ PHP_METHOD(Memcached, setByKey)
11591159}
11601160/* }}} */
11611161
1162- #if defined( LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x01000002
1162+ #ifdef HAVE_MEMCACHED_TOUCH
11631163/* {{{ Memcached::touch(string key, [, int expiration ])
11641164 Sets a new expiration for the given key */
11651165PHP_METHOD (Memcached , touch )
@@ -1496,7 +1496,7 @@ static void php_memc_store_impl(INTERNAL_FUNCTION_PARAMETERS, int op, zend_bool
14961496 key_len , payload , payload_len , expiration , flags );
14971497 }
14981498 break ;
1499- #ifdef HAVE_LIBMEMCACHED_TOUCH
1499+ #ifdef HAVE_MEMCACHED_TOUCH
15001500 case MEMC_OP_TOUCH :
15011501 if (!server_key ) {
15021502 status = memcached_touch (m_obj -> memc , key , key_len , expiration );
@@ -2126,7 +2126,7 @@ PHP_METHOD(Memcached, flushBuffers)
21262126}
21272127/* }}} */
21282128
2129- #if defined( LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
2129+ #ifdef HAVE_LIBMEMCACHED_CHECK_CONFIGURATION
21302130/* {{{ Memcached::getLastErrorMessage()
21312131 Returns the last error message that occurred */
21322132PHP_METHOD (Memcached , getLastErrorMessage )
@@ -2515,14 +2515,19 @@ static int php_memc_set_option(php_memc_t *i_obj, long option, zval *value TSRML
25152515 /*
25162516 * Assume that it's a libmemcached behavior option.
25172517 */
2518- flag = (memcached_behavior ) option ;
2519- convert_to_long (value );
2520-
2521- if (flag >= 0 && flag < MEMCACHED_BEHAVIOR_MAX ) {
2522- rc = memcached_behavior_set (m_obj -> memc , flag , (uint64_t ) Z_LVAL_P (value ));
2518+ if (option < 0 ) {
2519+ rc = MEMCACHED_INVALID_ARGUMENTS ;
25232520 }
25242521 else {
2525- rc = MEMCACHED_INVALID_ARGUMENTS ;
2522+ flag = (memcached_behavior ) option ;
2523+ convert_to_long (value );
2524+
2525+ if (flag < MEMCACHED_BEHAVIOR_MAX ) {
2526+ rc = memcached_behavior_set (m_obj -> memc , flag , (uint64_t ) Z_LVAL_P (value ));
2527+ }
2528+ else {
2529+ rc = MEMCACHED_INVALID_ARGUMENTS ;
2530+ }
25262531 }
25272532
25282533 if (php_memc_handle_error (i_obj , rc TSRMLS_CC ) < 0 ) {
@@ -4124,7 +4129,7 @@ static zend_function_entry memcached_class_methods[] = {
41244129
41254130 MEMC_ME (set , arginfo_set )
41264131 MEMC_ME (setByKey , arginfo_setByKey )
4127- #if HAVE_LIBMEMCACHED_TOUCH
4132+ #ifdef HAVE_MEMCACHED_TOUCH
41284133 MEMC_ME (touch , arginfo_touch )
41294134 MEMC_ME (touchByKey , arginfo_touchByKey )
41304135#endif
@@ -4155,10 +4160,9 @@ static zend_function_entry memcached_class_methods[] = {
41554160 MEMC_ME (addServers , arginfo_addServers )
41564161 MEMC_ME (getServerList , arginfo_getServerList )
41574162 MEMC_ME (getServerByKey , arginfo_getServerByKey )
4158- MEMC_ME (resetServerList , arginfo_resetServerList )
4159- MEMC_ME (quit , arginfo_quit )
4160- MEMC_ME (flushBuffers , arginfo_flushBuffers )
4161-
4163+ MEMC_ME (resetServerList , arginfo_resetServerList )
4164+ MEMC_ME (quit , arginfo_quit )
4165+ MEMC_ME (flushBuffers , arginfo_flushBuffers )
41624166
41634167#if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
41644168 MEMC_ME (getLastErrorMessage , arginfo_getLastErrorMessage )
@@ -4346,7 +4350,7 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
43464350 REGISTER_MEMC_CLASS_CONST_LONG (OPT_NUMBER_OF_REPLICAS , MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS );
43474351 REGISTER_MEMC_CLASS_CONST_LONG (OPT_RANDOMIZE_REPLICA_READ , MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ );
43484352#endif
4349- #if defined( HAVE_LIBMEMCACHED_REMOVE_FAILED_SERVERS ) && HAVE_LIBMEMCACHED_REMOVE_FAILED_SERVERS
4353+ #ifdef HAVE_MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS
43504354 REGISTER_MEMC_CLASS_CONST_LONG (OPT_REMOVE_FAILED_SERVERS , MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS );
43514355#endif
43524356
0 commit comments