Skip to content

Commit b15936c

Browse files
Timandessodabrew
authored andcommitted
Add optional parameter 'type' for method 'getStats' (#298)
1 parent 5fee5fa commit b15936c

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

memcached-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public function getLastDisconnectedServer( ) {}
275275

276276
public function flush( $delay = 0 ) {}
277277

278-
public function getStats( ) {}
278+
public function getStats( $type = null ) {}
279279

280280
public function getVersion( ) {}
281281

php_memcached.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,16 +2645,21 @@ memcached_return s_stat_execute_cb (php_memcached_instance_st instance, const ch
26452645
PHP_METHOD(Memcached, getStats)
26462646
{
26472647
memcached_return status;
2648+
char *args = NULL;
2649+
zend_string *args_string = NULL;
26482650
MEMC_METHOD_INIT_VARS;
26492651

2650-
if (zend_parse_parameters_none() == FAILURE) {
2652+
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|S!", &args_string) == FAILURE) {
26512653
return;
26522654
}
26532655

26542656
MEMC_METHOD_FETCH_OBJECT;
26552657

2658+
if (args_string)
2659+
args = ZSTR_VAL(args_string);
2660+
26562661
array_init(return_value);
2657-
status = memcached_stat_execute(intern->memc, NULL, s_stat_execute_cb, return_value);
2662+
status = memcached_stat_execute(intern->memc, args, s_stat_execute_cb, return_value);
26582663
if (s_memc_status_handle_result_code(intern, status) == FAILURE) {
26592664
zval_ptr_dtor(return_value);
26602665
RETURN_FALSE;
@@ -3927,6 +3932,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_setBucket, 3)
39273932
ZEND_END_ARG_INFO()
39283933

39293934
ZEND_BEGIN_ARG_INFO(arginfo_getStats, 0)
3935+
ZEND_ARG_INFO(0, args)
39303936
ZEND_END_ARG_INFO()
39313937

39323938
ZEND_BEGIN_ARG_INFO(arginfo_getVersion, 0)

0 commit comments

Comments
 (0)