--TEST-- Check stats does not hang on non-blocking binary protocol --SKIPIF-- --FILE-- setOption(Memcached::OPT_NO_BLOCK, true); $m->setOption(Memcached::OPT_BINARY_PROTOCOL, true); $stats = $m->getStats(); $conns1 = $stats[$key]['total_connections']; $stats = $m->getStats(); $conns2 = $stats[$key]['total_connections']; var_dump($conns1 == $conns2); var_dump($m->getOption(Memcached::OPT_NO_BLOCK)); var_dump($m->getOption(Memcached::OPT_BINARY_PROTOCOL)); echo "OK" . PHP_EOL; // If either or both options are false no need to reconnect $m->setOption(Memcached::OPT_NO_BLOCK, false); $m->setOption(Memcached::OPT_BINARY_PROTOCOL, true); $stats = $m->getStats(); $conns1 = $stats[$key]['total_connections']; $stats = $m->getStats(); $conns2 = $stats[$key]['total_connections']; var_dump($conns1 == $conns2); var_dump($m->getOption(Memcached::OPT_NO_BLOCK)); var_dump($m->getOption(Memcached::OPT_BINARY_PROTOCOL)); echo "OK" . PHP_EOL; // If either or both options are false no need to reconnect $m->setOption(Memcached::OPT_NO_BLOCK, true); $m->setOption(Memcached::OPT_BINARY_PROTOCOL, false); $stats = $m->getStats(); $conns1 = $stats[$key]['total_connections']; $stats = $m->getStats(); $conns2 = $stats[$key]['total_connections']; var_dump($conns1 == $conns2); var_dump($m->getOption(Memcached::OPT_NO_BLOCK)); var_dump($m->getOption(Memcached::OPT_BINARY_PROTOCOL)); echo "OK" . PHP_EOL; // If either or both options are false no need to reconnect $m->setOption(Memcached::OPT_NO_BLOCK, false); $m->setOption(Memcached::OPT_BINARY_PROTOCOL, false); $stats = $m->getStats(); $conns1 = $stats[$key]['total_connections']; $stats = $m->getStats(); $conns2 = $stats[$key]['total_connections']; var_dump($conns1 == $conns2); var_dump($m->getOption(Memcached::OPT_NO_BLOCK)); var_dump($m->getOption(Memcached::OPT_BINARY_PROTOCOL)); echo "OK" . PHP_EOL; ?> --EXPECT-- bool(false) int(1) int(1) OK bool(true) int(0) int(1) OK bool(true) int(1) int(0) OK bool(true) int(0) int(0) OK