1--TEST--
2Test for bug 155
3--SKIPIF--
4<?php
5$min_version = "1.4.8";
6include dirname(__FILE__) . "/skipif.inc";
7// The touch command in binary mode will work in libmemcached 1.0.16, but runs out the timeout clock
8// See https://github.com/php-memcached-dev/php-memcached/issues/310 for further explanation
9// The problem is fixed fully in libmemcached 1.0.18, so we'll focus tests on that version
10if (Memcached::LIBMEMCACHED_VERSION_HEX < 0x01000018) die ('skip too old libmemcached');
11?>
12--FILE--
13<?php
14include dirname (__FILE__) . '/config.inc';
15
16$m = new Memcached ();
17
18$m->setOption(Memcached::OPT_BINARY_PROTOCOL, true);
19$m->addServer(MEMC_SERVER_HOST, MEMC_SERVER_PORT);
20
21$key = 'bug_155_' . uniqid();
22
23$m->set ($key, 'test', time() + 86400);
24
25$m->get ($key);
26echo "GET: " . $m->getResultMessage() . PHP_EOL;
27
28$m->touch ($key, time() + 86400);
29echo "TOUCH: " . $m->getResultMessage() . PHP_EOL;
30
31$m->touch ($key, time() + 86400);
32echo "TOUCH: " . $m->getResultMessage() . PHP_EOL;
33
34$m->get ($key);
35echo "GET: " . $m->getResultMessage() . PHP_EOL;
36
37$m->get ($key);
38echo "GET: " . $m->getResultMessage() . PHP_EOL;
39
40echo "DONE" . PHP_EOL;
41
42--EXPECT--
43GET: SUCCESS
44TOUCH: SUCCESS
45TOUCH: SUCCESS
46GET: SUCCESS
47GET: SUCCESS
48DONE
49