Page 1 of 1

Probelm With session_destroy()

Posted: Fri Sep 07, 2007 5:12 pm
by shwanky
Anyone see why these functions are erring?

Code: Select all

function logout()
        {
                global $url;
                if(!headers_sent())
                        session_start();

                $_SESSION = array();

                if (isset($_COOKIE[session_name()]))
                        setcookie(session_name(), '', time()-42000, '/');

                session_destroy();
                //session_unset($_SESSION); // Temporary Fix
                redirect_to($url['login']);
        }

        function redirect_to($url)
        {
                if(session_id() != '')
                        session_write_close();

                header('location: ' . $url);
                exit();
        }

Code: Select all

Warning: session_destroy(): Session object destruction failed in session.inc.php on line 77

Warning: Cannot modify header information - headers already sent by (output started at session.inc.php:77) in common.inc.php on line 8

Posted: Fri Sep 07, 2007 5:31 pm
by josa
It could be related to permissions on the directory your session.save_path is set to. You get this error if PHP can't delete the session file.

/josa

Posted: Fri Sep 07, 2007 5:45 pm
by shwanky
josa wrote:It could be related to permissions on the directory your session.save_path is set to. You get this error if PHP can't delete the session file.

/josa
Already checked the permission. That doesn't seem to be the problem.

Posted: Fri Sep 07, 2007 5:50 pm
by shwanky
session_destroy() seems to be destroying the session because the physical file is being destroyed.