Files
pecl-memcache/tests/024b.phpt
Zaffy e090f05a05 More work on pecl-memcache (#76)
* Use zend_bool for ini bool settings

Related to #56

* Initial work for php 8

* php7 -> php8

* Add test for #53

* Fix support for binary protocol

* php8 -> src

* Backwards compatibility with php 7.3, 7.4

This will allow us to have one unified branch that will compile
under different versions of php.

* Add test for pecl bug #77900

* Fix some memory leaks

* Support for reflection

- added / updated arginfos
- fix functions returning NULL instead of advertised return type,
  For example, when memcached returned error on "delete", function
  returned null instead of false
- added tests for both php8 and 7

* Fix typo

* Update config.w32

Co-authored-by: Tyson Andre <tyson.andre@uwaterloo.ca>

Co-authored-by: Tyson Andre <tysonandre775@hotmail.com>
Co-authored-by: Tomas Srnka <tomassrnka@users.noreply.github.com>
Co-authored-by: Tyson Andre <tyson.andre@uwaterloo.ca>
2020-10-16 09:52:01 +02:00

60 lines
1.3 KiB
PHP

--TEST--
memcache_close(), memcache_get()
--SKIPIF--
<?php
if (PHP_VERSION_ID >= 80000)
die('skip php prior to 8 only');
include 'connect.inc'; if (!isset($host2)) die('skip $host2 not set'); ?>
--FILE--
<?php
include 'connect.inc';
memcache_add_server($memcache, $host2, $port2);
memcache_add_server($memcache, $nonExistingHost, $nonExistingPort);
$result1 = memcache_close($memcache);
var_dump($result1);
$memcache = new Memcache();
$result2 = $memcache->connect($host, $port);
$result3 = memcache_set($memcache, 'test_key', 'test', false, 1);
$result4 = memcache_close($memcache);
// This will fail since all servers have been removed
$result5 = memcache_get($memcache, 'test_key');
var_dump($result2);
var_dump($result3);
var_dump($result4);
var_dump($result5);
var_dump(memcache_close($memcache));
var_dump(memcache_close($memcache));
try {
var_dump(memcache_close(new stdClass));
} catch (TypeError $e) {
echo "{$e->getMessage()}\n";
}
try {
var_dump(memcache_close(""));
} catch (TypeError $e) {
echo "{$e->getMessage()}\n";
}
echo "Done\n";
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
Argument 1 passed to memcache_close() must be an instance of MemcachePool, instance of stdClass given
Argument 1 passed to memcache_close() must be an instance of MemcachePool, string given
Done