diff options
| author | jvoisin | 2018-12-26 12:14:47 +0100 |
|---|---|---|
| committer | jvoisin | 2018-12-26 12:14:47 +0100 |
| commit | 63898e19a2050cb797e8f36e7389dbb553343af7 (patch) | |
| tree | d67428d1e466cd1733a95fd4cf015008ad31255e /src | |
| parent | 2ca73d842719c1c8002a20fbbc93c57d1308d54e (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_session.c | 7 | ||||
| -rw-r--r-- | src/tests/set_custom_session_handler2.phpt | 36 |
2 files changed, 36 insertions, 7 deletions
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() { | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | static PHP_INI_MH(sp_OnUpdateSaveHandler) { | 95 | static PHP_INI_MH(sp_OnUpdateSaveHandler) { |
| 96 | if (stage == PHP_INI_STAGE_RUNTIME && | ||
| 97 | SESSION_G(session_status) == php_session_none && s_original_mod && | ||
| 98 | zend_string_equals_literal(new_value, "user") == 0 && | ||
| 99 | strcmp(((ps_module *)s_original_mod)->s_name, "user") == 0) { | ||
| 100 | return SUCCESS; | ||
| 101 | } | ||
| 102 | |||
| 103 | SESSION_G(mod) = s_original_mod; | 96 | SESSION_G(mod) = s_original_mod; |
| 104 | 97 | ||
| 105 | int r = old_OnUpdateSaveHandler(entry, new_value, mh_arg1, mh_arg2, mh_arg3, | 98 | 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 @@ | |||
| 1 | --TEST-- | ||
| 2 | Set a custom session handler, twice | ||
| 3 | --SKIPIF-- | ||
| 4 | <?php if (!extension_loaded("snuffleupagus")) die "skip"; ?> | ||
| 5 | --INI-- | ||
| 6 | sp.configuration_file={PWD}/config/config_crypt_session.ini | ||
| 7 | session.save_path = "/tmp" | ||
| 8 | --ENV-- | ||
| 9 | return <<<EOF | ||
| 10 | REMOTE_ADDR=127.0.0.1 | ||
| 11 | EOF; | ||
| 12 | --FILE-- | ||
| 13 | <?php | ||
| 14 | session_set_save_handler(new SessionHandler(), true); | ||
| 15 | session_start(); | ||
| 16 | $_SESSION['a'] = 'b'; | ||
| 17 | #var_dump($_SESSION); | ||
| 18 | session_destroy(); | ||
| 19 | session_set_save_handler(new SessionHandler(), true); | ||
| 20 | session_start(); | ||
| 21 | $_SESSION['a'] = 'b'; | ||
| 22 | var_dump($_SESSION); | ||
| 23 | session_destroy(); | ||
| 24 | ?> | ||
| 25 | --EXPECTF-- | ||
| 26 | Warning: SessionHandler::open(): Cannot call session save handler in a recursive manner in%s/tests/set_custom_session_handler2.php on line 8 | ||
| 27 | |||
| 28 | Warning: SessionHandler::close(): Cannot call session save handler in a recursive manner in %stests/set_custom_session_handler2.php on line 8 | ||
| 29 | |||
| 30 | Warning: session_start(): Failed to initialize storage module: user (path: %s) in %stests/set_custom_session_handler2.php on line 8 | ||
| 31 | array(1) { | ||
| 32 | ["a"]=> | ||
| 33 | string(1) "b" | ||
| 34 | } | ||
| 35 | |||
| 36 | Warning: session_destroy(): Trying to destroy uninitialized session in %s/tests/set_custom_session_handler2.php on line %d | ||
