From 840479e06f1a3ce94f106b4978c80dc104321810 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 26 Dec 2018 13:17:36 +0100 Subject: Fix the build for php7.0 We only want to prevent crash/infinite recursion, we don't really care about the error/warning messages. --- src/sp_session.c | 10 ++++++++++ src/tests/set_custom_session_handler2.phpt | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') 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() { } static PHP_INI_MH(sp_OnUpdateSaveHandler) { +#if PHP_VERSION_ID < 70100 + /* PHP7.0 doesn't handle well recusively set session handlers */ + if (stage == PHP_INI_STAGE_RUNTIME && + SESSION_G(session_status) == php_session_none && s_original_mod && + zend_string_equals_literal(new_value, "user") == 0 && + strcmp(((ps_module *)s_original_mod)->s_name, "user") == 0) { + return SUCCESS; + } +#endif + SESSION_G(mod) = s_original_mod; 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); session_destroy(); ?> --EXPECTF-- -%s: SessionHandler::open(): Cannot call session save handler in a recursive manner in %s/tests/set_custom_session_handler2.php on line 8 %a -- cgit v1.3