From 7a8f4193836a81b31c51eb69cc4eaa22a62c2836 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 19 Mar 2019 12:37:08 +0100 Subject: update to 4.0.2 from https://github.com/websupport-sk/pecl-memcache add patch for PHP < 7.2 from https://github.com/websupport-sk/pecl-memcache/pull/40 add patch to allow session.save_path from https://github.com/websupport-sk/pecl-memcache/pull/45 --- 45.patch | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 45.patch (limited to '45.patch') diff --git a/45.patch b/45.patch new file mode 100644 index 0000000..3e7e196 --- /dev/null +++ b/45.patch @@ -0,0 +1,114 @@ +From fd0cc8c9b0171a36116917332acc9f479e45ec81 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Tue, 19 Mar 2019 11:12:37 +0100 +Subject: [PATCH] allow to work with standard session.save_path option and + session_save_path function + +--- + php7/memcache_session.c | 8 +++-- + tests/036b.phpt | 70 +++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 76 insertions(+), 2 deletions(-) + create mode 100644 tests/036b.phpt + +diff --git a/php7/memcache_session.c b/php7/memcache_session.c +index 7807942..4cc356d 100644 +--- a/php7/memcache_session.c ++++ b/php7/memcache_session.c +@@ -56,7 +56,12 @@ PS_OPEN_FUNC(memcache) + zval params, *param; + int i, j, path_len; + +- char *path = MEMCACHE_G(session_save_path); ++ const char *path = MEMCACHE_G(session_save_path); ++ if (!path) { ++ /* allow to work with standard session.save_path option ++ and session_save_path function */ ++ path = save_path; ++ } + if (!path) { + PS_SET_MOD_DATA(NULL); + return FAILURE; +@@ -98,7 +103,6 @@ PS_OPEN_FUNC(memcache) + if (!url) { + php_error_docref(NULL, E_WARNING, + "Failed to parse memcache.save_path (error at offset %d, url was '%s')", i, path); +- efree(path); + + mmc_pool_free(pool); + PS_SET_MOD_DATA(NULL); +diff --git a/tests/036b.phpt b/tests/036b.phpt +new file mode 100644 +index 0000000..858807a +--- /dev/null ++++ b/tests/036b.phpt +@@ -0,0 +1,70 @@ ++--TEST-- ++ini_set('session.save_path') ++--SKIPIF-- ++ ++--FILE-- ++get($id); ++session_write_close(); ++$result3 = $memcache->get($id); ++ ++// Test destroy ++$result4 = session_start(); ++$result5 = session_destroy(); ++$result6 = $memcache->get($id); ++ ++// Test large session ++$session_save_path = "tcp://$host:$port"; ++session_save_path($session_save_path); ++ ++session_start(); ++$largeval = str_repeat('a', 1024*2048); ++$_SESSION['_test_key']= $largeval; ++session_write_close(); ++ ++// test large cookie lifetime ++ini_set('session.gc_maxlifetime', 1209600); ++$result7 = session_start(); ++$id = session_id(); ++$_SESSION['_test_key'] = 'Test'; ++$result8 = $memcache->get($id); ++session_write_close(); ++$result9 = $memcache->get($id); ++ ++ ++var_dump($result1); ++var_dump($id); ++var_dump($result2); ++var_dump($result3); ++var_dump($result4); ++var_dump($result5); ++var_dump($result6); ++var_dump($result7); ++var_dump($result8); ++var_dump($result9); ++ ++?> ++--EXPECTF-- ++bool(true) ++string(%d) "%s" ++bool(false) ++string(%d) "%s" ++bool(true) ++bool(true) ++bool(false) ++bool(true) ++string(%d) "%s" ++string(%d) "%s" -- cgit