@@ -3265,6 +3265,32 @@ static PHP_METHOD(Memcached, setSaslAuthData)
32653265/* }}} */
32663266#endif /* HAVE_MEMCACHED_SASL */
32673267
3268+ #ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
3269+ /* {{{ Memcached::setEncodingKey(string key)
3270+ Sets AES encryption key (libmemcached 1.0.6 and higher) */
3271+ static PHP_METHOD (Memcached , setEncodingKey )
3272+ {
3273+ MEMC_METHOD_INIT_VARS ;
3274+ memcached_return status ;
3275+ zend_string * key ;
3276+
3277+ /* "S" */
3278+ ZEND_PARSE_PARAMETERS_START (1 , 1 )
3279+ Z_PARAM_STR (key )
3280+ ZEND_PARSE_PARAMETERS_END ();
3281+
3282+ MEMC_METHOD_FETCH_OBJECT ;
3283+
3284+ status = memcached_set_encoding_key (intern -> memc , ZSTR_VAL (key ), ZSTR_LEN (key ));
3285+
3286+ if (s_memc_status_handle_result_code (intern , status ) == FAILURE ) {
3287+ RETURN_FALSE ;
3288+ }
3289+ RETURN_TRUE ;
3290+ }
3291+ /* }}} */
3292+ #endif /* HAVE_MEMCACHED_SET_ENCODING_KEY */
3293+
32683294/* {{{ Memcached::getResultCode()
32693295 Returns the result code from the last operation */
32703296static PHP_METHOD (Memcached , getResultCode )
@@ -4282,6 +4308,15 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
42824308 REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_MSGPACK , 0 );
42834309#endif
42844310
4311+ /*
4312+ * Indicate whether set_encoding_key is available
4313+ */
4314+ #ifdef HAVE_MEMCACHED_SET_ENCODING_KEY
4315+ REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_ENCODING , 1 );
4316+ #else
4317+ REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_ENCODING , 0 );
4318+ #endif
4319+
42854320#ifdef HAVE_MEMCACHED_SESSION
42864321 REGISTER_MEMC_CLASS_CONST_BOOL (HAVE_SESSION , 1 );
42874322#else
0 commit comments