From 63898e19a2050cb797e8f36e7389dbb553343af7 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Wed, 26 Dec 2018 12:14:47 +0100 Subject: Remove an unnecessary guard against infinite recursion in session handling This used to be useful in the times of PHP5.4/Suhosin (https://github.com/sektioneins/suhosin/issues/60), but nowadays, php is handling this case on its own. --- src/sp_session.c | 7 ------ src/tests/set_custom_session_handler2.phpt | 36 ++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 src/tests/set_custom_session_handler2.phpt (limited to 'src') diff --git a/src/sp_session.c b/src/sp_session.c index b3db622..bd11557 100644 --- a/src/sp_session.c +++ b/src/sp_session.c @@ -93,13 +93,6 @@ static void sp_hook_session_module() { } static PHP_INI_MH(sp_OnUpdateSaveHandler) { - 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; - } - 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 new file mode 100644 index 0000000..ecd40ea --- /dev/null +++ b/src/tests/set_custom_session_handler2.phpt @@ -0,0 +1,36 @@ +--TEST-- +Set a custom session handler, twice +--SKIPIF-- + +--INI-- +sp.configuration_file={PWD}/config/config_crypt_session.ini +session.save_path = "/tmp" +--ENV-- +return << +--EXPECTF-- +Warning: SessionHandler::open(): Cannot call session save handler in a recursive manner in%s/tests/set_custom_session_handler2.php on line 8 + +Warning: SessionHandler::close(): Cannot call session save handler in a recursive manner in %stests/set_custom_session_handler2.php on line 8 + +Warning: session_start(): Failed to initialize storage module: user (path: %s) in %stests/set_custom_session_handler2.php on line 8 +array(1) { + ["a"]=> + string(1) "b" +} + +Warning: session_destroy(): Trying to destroy uninitialized session in %s/tests/set_custom_session_handler2.php on line %d -- cgit v1.3