diff --git a/.travis.yml b/.travis.yml index 4aae7552..02c367a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,6 @@ php: matrix: fast_finish: true - allow_failures: - - php: 7.1 env: - LIBMEMCACHED_VERSION=1.0.18 # Debian Jessie / Ubuntu Xenial @@ -31,6 +29,4 @@ script: cache: directories: - - $HOME/cache - - + - $HOME/cache \ No newline at end of file diff --git a/package.xml b/package.xml index 0dd61ada..2091f2e2 100644 --- a/package.xml +++ b/package.xml @@ -165,6 +165,7 @@ Tests + diff --git a/tests/invoke_callback_2.phpt b/tests/invoke_callback_2.phpt index 07e84f94..9749ed18 100644 --- a/tests/invoke_callback_2.phpt +++ b/tests/invoke_callback_2.phpt @@ -18,9 +18,9 @@ function init_cb_fail($m, $id) { echo "configured, should not be called.\n"; } -function init_cb_arg($m, $id, $arg) { +function init_cb_arg($m, $id) { + var_dump(func_num_args()); var_dump($id); - var_dump($arg); } function init_nopersist_cb($m, $id) { @@ -33,15 +33,14 @@ class Foo extends Memcached { parent::__construct($id, array($this, 'init')); } - function init($obj, $id, $options) { + function init($obj, $id) { + var_dump(func_num_args()); var_dump($this->isPristine()); var_dump($this->isPersistent()); var_dump($id); } } -error_reporting(0); - echo "cb call\n"; $m1 = new Memcached('foo1', 'init_cb'); @@ -50,7 +49,6 @@ $m1 = new Memcached('foo1', 'init_cb_fail'); echo "cb arg without arg\n"; $m1 = new Memcached('foo3', 'init_cb_arg'); -echo $php_errormsg, "\n"; echo "cb arg not persistent\n"; $m1 = new Memcached(null, 'init_nopersist_cb'); @@ -63,7 +61,7 @@ $m1 = new Foo('baz'); echo "cb second persistent in object\n"; $m1 = new Foo('baz'); - +?> --EXPECT-- cb call string(9) "Memcached" @@ -71,17 +69,18 @@ bool(true) string(4) "foo1" cb not run cb arg without arg +int(2) string(4) "foo3" -NULL - cb arg not persistent bool(false) NULL cb in object +int(2) bool(true) bool(false) NULL cb persistent in object +int(2) bool(true) bool(true) string(3) "baz" diff --git a/tests/session_lock-php71.phpt b/tests/session_lock-php71.phpt new file mode 100644 index 00000000..207f64cf --- /dev/null +++ b/tests/session_lock-php71.phpt @@ -0,0 +1,62 @@ +--TEST-- +Session lock +--SKIPIF-- + +--INI-- +memcached.sess_locking = true +memcached.sess_lock_wait_min = 500 +memcached.sess_lock_wait_max = 1000 +memcached.sess_lock_retries = 3 +memcached.sess_prefix = "memc.test." + +session.save_handler = memcached + +--FILE-- +addServer(MEMC_SERVER_HOST, MEMC_SERVER_PORT); + +ob_start(); +ini_set ('session.save_path', MEMC_SERVER_HOST . ':' . MEMC_SERVER_PORT); + +session_start(); +$session_id = session_id(); + +$_SESSION["test"] = "hello"; +session_write_close(); + +session_start(); +var_dump ($m->get ('memc.test.' . session_id())); +var_dump ($m->get ('memc.test.lock.' . session_id())); +session_write_close(); +var_dump ($m->get ('memc.test.lock.' . session_id())); + +// Test lock min / max +$m->set ('memc.test.lock.' . $session_id, '1'); + +$time_start = microtime(true); +session_start(); +$time = microtime(true) - $time_start; + +if (round ($time, 1) != 2.5) { + echo "Waited longer than expected: $time" . PHP_EOL; +} +echo "OK"; + +--EXPECTF-- +string(17) "test|s:5:"hello";" +string(1) "1" +bool(false) + +Warning: session_start(): Unable to clear session lock record in %s on line %d + +Warning: session_start(): Failed to read session data: memcached (path: 127.0.0.1:11211) in %s on line %d +OK diff --git a/tests/session_lock.phpt b/tests/session_lock.phpt index 79c32888..570e5a2a 100644 --- a/tests/session_lock.phpt +++ b/tests/session_lock.phpt @@ -4,6 +4,8 @@ Session lock = 70100) print "skip"; ?> --INI-- memcached.sess_locking = true