summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-12-26 13:17:36 +0100
committerjvoisin2018-12-26 13:17:36 +0100
commit840479e06f1a3ce94f106b4978c80dc104321810 (patch)
tree9ad145c5fa10f6465209afe2bb6fae89eaab870d
parent188f877ccdd12b52b154b6deca11d4a1efe428a5 (diff)
Fix the build for php7.0
We only want to prevent crash/infinite recursion, we don't really care about the error/warning messages.
-rw-r--r--src/sp_session.c10
-rw-r--r--src/tests/set_custom_session_handler2.phpt1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/sp_session.c b/src/sp_session.c
index bd11557..22b6688 100644
--- a/src/sp_session.c
+++ b/src/sp_session.c
@@ -93,6 +93,16 @@ static void sp_hook_session_module() {
93} 93}
94 94
95static PHP_INI_MH(sp_OnUpdateSaveHandler) { 95static PHP_INI_MH(sp_OnUpdateSaveHandler) {
96#if PHP_VERSION_ID < 70100
97 /* PHP7.0 doesn't handle well recusively set session handlers */
98 if (stage == PHP_INI_STAGE_RUNTIME &&
99 SESSION_G(session_status) == php_session_none && s_original_mod &&
100 zend_string_equals_literal(new_value, "user") == 0 &&
101 strcmp(((ps_module *)s_original_mod)->s_name, "user") == 0) {
102 return SUCCESS;
103 }
104#endif
105
96 SESSION_G(mod) = s_original_mod; 106 SESSION_G(mod) = s_original_mod;
97 107
98 int r = old_OnUpdateSaveHandler(entry, new_value, mh_arg1, mh_arg2, mh_arg3, 108 int r = old_OnUpdateSaveHandler(entry, new_value, mh_arg1, mh_arg2, mh_arg3,
diff --git a/src/tests/set_custom_session_handler2.phpt b/src/tests/set_custom_session_handler2.phpt
index 8832efc..18bc3f7 100644
--- a/src/tests/set_custom_session_handler2.phpt
+++ b/src/tests/set_custom_session_handler2.phpt
@@ -23,5 +23,4 @@ var_dump($_SESSION);
23session_destroy(); 23session_destroy();
24?> 24?>
25--EXPECTF-- 25--EXPECTF--
26%s: SessionHandler::open(): Cannot call session save handler in a recursive manner in %s/tests/set_custom_session_handler2.php on line 8
27%a 26%a