mirror of
https://github.com/php-win-ext/pecl-memcache.git
synced 2026-03-24 00:52:07 +01:00
fix memory leaks add variant for redundancy test for php73 fix leak in memcache_pool add todo: to fix freeing resources in 7.3 . test 044.phpt has now variant 044b because 7.3 no longer allows changing internal session state (e.g. call session_id . ) , this probably needs better handling altogether . but we want to test at least basic redundancy for now zend_resources in mmc_server_free are freed by GC before, so we don't free again . disable udp connect for now cleanup from ci
78 lines
1.7 KiB
PHP
78 lines
1.7 KiB
PHP
--TEST--
|
|
ini_set('memcache.redundancy')
|
|
--SKIPIF--
|
|
<?php include 'connect.inc'; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
include 'connect.inc';
|
|
|
|
ini_set('memcache.redundancy', 1);
|
|
$memcache = test_connect_pool();
|
|
$memcache1 = test_connect1();
|
|
$memcache2 = test_connect2();
|
|
|
|
$memcache1->delete($balanceKey1);
|
|
$memcache2->delete($balanceKey1);
|
|
|
|
$result = $memcache->get($balanceKey1);
|
|
var_dump($result);
|
|
|
|
$memcache->set($balanceKey1, 'Test1');
|
|
|
|
$result1 = $memcache1->get($balanceKey1);
|
|
$result2 = $memcache2->get($balanceKey1);
|
|
var_dump($result1);
|
|
var_dump($result2);
|
|
|
|
ini_set('memcache.redundancy', 10);
|
|
$memcache = test_connect_pool();
|
|
|
|
// Test set
|
|
$memcache->set($balanceKey1, 'Test2');
|
|
|
|
$result1 = $memcache1->get($balanceKey1);
|
|
$result2 = $memcache2->get($balanceKey1);
|
|
var_dump($result1);
|
|
var_dump($result2);
|
|
|
|
// Test increment
|
|
$memcache->set($balanceKey1, '1');
|
|
$memcache->increment($balanceKey1);
|
|
|
|
$result1 = $memcache1->get($balanceKey1);
|
|
$result2 = $memcache2->get($balanceKey1);
|
|
var_dump($result1);
|
|
var_dump($result2);
|
|
|
|
// Test delete
|
|
$memcache->delete($balanceKey1);
|
|
|
|
$result1 = $memcache1->get($balanceKey1);
|
|
$result2 = $memcache2->get($balanceKey1);
|
|
var_dump($result1);
|
|
var_dump($result2);
|
|
|
|
// Test invalid values
|
|
ini_set('memcache.redundancy', 0);
|
|
ini_set('memcache.redundancy', -1);
|
|
ini_set('memcache.redundancy', 'Test');
|
|
|
|
?>
|
|
--EXPECTF--
|
|
bool(false)
|
|
bool(false)
|
|
string(5) "Test1"
|
|
string(5) "Test2"
|
|
string(5) "Test2"
|
|
string(1) "2"
|
|
string(1) "2"
|
|
bool(false)
|
|
bool(false)
|
|
|
|
Warning: ini_set(): memcache.redundancy must be a positive integer ('0' given) in %s
|
|
|
|
Warning: ini_set(): memcache.redundancy must be a positive integer ('-1' given) in %s
|
|
|
|
Warning: ini_set(): memcache.redundancy must be a positive integer ('Test' given) in %s
|