mirror of
https://github.com/php-win-ext/pecl-memcache.git
synced 2026-03-24 00:52:07 +01:00
sync with ws repo
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
This commit is contained in:
@@ -813,10 +813,6 @@ void mmc_server_sleep(mmc_t *mmc) /*
|
||||
|
||||
void mmc_server_free(mmc_t *mmc) /* {{{ */
|
||||
{
|
||||
mmc_server_sleep(mmc);
|
||||
_mmc_server_disconnect(mmc, &(mmc->tcp), 0);
|
||||
_mmc_server_disconnect(mmc, &(mmc->udp), 0);
|
||||
|
||||
pefree(mmc->host, mmc->persistent);
|
||||
pefree(mmc, mmc->persistent);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,4 @@ Warning: ini_set(): memcache.redundancy must be a positive integer ('0' given) i
|
||||
|
||||
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
|
||||
Warning: ini_set(): memcache.redundancy must be a positive integer ('Test' given) in %s
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
--TEST--
|
||||
ini_set('memcache.session_redundancy')
|
||||
--SKIPIF--
|
||||
<?php include 'connect.inc'; ?>
|
||||
<?php
|
||||
include 'connect.inc';
|
||||
include 'version.inc';
|
||||
if (defined('PHP_VERSION_ID') && !(PHP_VERSION_ID < 70300)) {
|
||||
die("skip");
|
||||
}
|
||||
?>
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
||||
39
tests/044b.phpt
Normal file
39
tests/044b.phpt
Normal file
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
ini_set('memcache.session_redundancy')
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include 'connect.inc';
|
||||
include 'version.inc';
|
||||
print(PHP_VERSION_ID);
|
||||
if (defined('PHP_VERSION_ID') && (PHP_VERSION_ID > 70200)) {
|
||||
die("skip");
|
||||
}
|
||||
?>
|
||||
|
||||
--FILE--
|
||||
<?php
|
||||
include 'connect.inc';
|
||||
|
||||
ini_set('memcache.session_redundancy', 2);
|
||||
ini_set('session.save_handler', 'memcache');
|
||||
ini_set('memcache.session_save_path', "tcp://$host:$port?udp_port=$udpPort,tcp://$host2:$port2?udp_port=$udpPort2");
|
||||
|
||||
$memcache1 = test_connect1();
|
||||
$memcache2 = test_connect2();
|
||||
$memcache1->delete($balanceKey1);
|
||||
$memcache2->delete($balanceKey1);
|
||||
|
||||
// Test set
|
||||
session_id($balanceKey1);
|
||||
session_start();
|
||||
$_SESSION['key'] = 'Test1';
|
||||
session_write_close();
|
||||
|
||||
$result1 = $memcache1->get($balanceKey1);
|
||||
$result2 = $memcache2->get($balanceKey1);
|
||||
var_dump($result1);
|
||||
var_dump($result2);
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(16) "key%sTest1%s"
|
||||
string(16) "key%sTest1%s"
|
||||
@@ -12,11 +12,11 @@ error_reporting(E_ALL);
|
||||
|
||||
$host = "localhost";
|
||||
$port = 11211;
|
||||
$udpPort = 11211;
|
||||
//$udpPort = 11211;
|
||||
|
||||
$host2 = "localhost";
|
||||
$port2 = 11212;
|
||||
$udpPort2 = 11212;
|
||||
//$udpPort2 = 11212;
|
||||
|
||||
//ini_set('memcache.hash_strategy', 'standard');
|
||||
//ini_set('memcache.hash_function', 'fnv');
|
||||
|
||||
Reference in New Issue
Block a user