[ticket/16207] Add session.force_sid parameter to allow fixing settings

PHPBB3-16207
This commit is contained in:
Marc Alexander 2021-07-17 21:30:42 +02:00
parent 5b68527eec
commit fe1b9d5384
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
4 changed files with 19 additions and 1 deletions

View file

@ -4,3 +4,6 @@ imports:
core: core:
require_dev_dependencies: true require_dev_dependencies: true
allow_install_dir: true allow_install_dir: true
session:
force_sid: false

View file

@ -62,6 +62,7 @@ class container_configuration implements ConfigurationInterface
->arrayNode('session') ->arrayNode('session')
->addDefaultsIfNotSet() ->addDefaultsIfNotSet()
->children() ->children()
->booleanNode('force_sid')->defaultValue(false)->end()
->booleanNode('log_errors')->defaultValue(false)->end() ->booleanNode('log_errors')->defaultValue(false)->end()
->end() ->end()
->end() ->end()

View file

@ -478,7 +478,7 @@ class session
*/ */
function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)
{ {
global $db, $config, $cache, $phpbb_container, $phpbb_dispatcher; global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher;
$this->data = array(); $this->data = array();
@ -689,6 +689,8 @@ class session
$db->sql_query($sql); $db->sql_query($sql);
} }
$SID = '?sid=';
$_SID = '';
return true; return true;
} }
else else
@ -781,6 +783,11 @@ class session
} }
// refresh data // refresh data
if ($phpbb_container->getParameter('session.force_sid'))
{
$SID = '?sid=' . $this->session_id;
$_SID = $this->session_id;
}
$this->data = array_merge($this->data, $sql_ary); $this->data = array_merge($this->data, $sql_ary);
if (!$bot) if (!$bot)
@ -820,6 +827,12 @@ class session
SET user_lastvisit = ' . (int) $this->data['session_time'] . ' SET user_lastvisit = ' . (int) $this->data['session_time'] . '
WHERE user_id = ' . (int) $this->data['user_id']; WHERE user_id = ' . (int) $this->data['user_id'];
$db->sql_query($sql); $db->sql_query($sql);
if ($phpbb_container->getParameter('session.force_sid'))
{
$SID = '?sid=';
$_SID = '';
}
} }
$session_data = $sql_ary; $session_data = $sql_ary;

View file

@ -22,6 +22,7 @@ class phpbb_mock_container_builder implements ContainerInterface
{ {
$this->setParameter('debug.load_time', false); $this->setParameter('debug.load_time', false);
$this->setParameter('session.log_errors', false); $this->setParameter('session.log_errors', false);
$this->setParameter('session.force_sid', true);
} }
/** /**