X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=f2e09daa936fd66801cda26371734bb144297c15;hb=061e7891e9c690b8aaa1a14f379503dbf26019e4;hp=f8ca92920983572a3d6cc7901c34e172d1907ffd;hpb=9cc7df51d64bb9b829e4a54ee2449c542209550d;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index f8ca929209..f2e09daa93 100644 --- a/lib/util.php +++ b/lib/util.php @@ -275,25 +275,25 @@ function common_have_session() return (0 != strcmp(session_id(), '')); } +/** + * Make sure session is started and handled by + * the correct handler. + */ function common_ensure_session() { - $c = null; - if (array_key_exists(session_name(), $_COOKIE)) { - $c = $_COOKIE[session_name()]; - } if (!common_have_session()) { if (common_config('sessions', 'handle')) { - Session::setSaveHandler(); + session_set_save_handler(new InternalSessionHandler(), true); + } + if (array_key_exists(session_name(), $_GET)) { + $id = $_GET[session_name()]; + } else if (array_key_exists(session_name(), $_COOKIE)) { + $id = $_COOKIE[session_name()]; + } + if (isset($id)) { + session_id($id); } - if (array_key_exists(session_name(), $_GET)) { - $id = $_GET[session_name()]; - } else if (array_key_exists(session_name(), $_COOKIE)) { - $id = $_COOKIE[session_name()]; - } - if (isset($id)) { - session_id($id); - } - @session_start(); + session_start(); if (!isset($_SESSION['started'])) { $_SESSION['started'] = time(); if (!empty($id)) {