php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5724 Write-Hanlder. When session_set_save_handler defined, write handler not called
Submitted: 2000-07-21 17:01 UTC Modified: 2000-07-25 18:06 UTC
From: mepooky at freesurf dot ch Assigned:
Status: Closed Package: Session related
PHP Version: 4.0 Release Candidate 2 OS: linux
Private report: No CVE-ID: None
 [2000-07-21 17:01 UTC] mepooky at freesurf dot ch
<?php
// sess_write never gets called

function sess_open($save_path, $session_name) {
        echo "session_open called<br>";
        return true;
}

function sess_close() {
        echo "session close called<br>";
        return true;
}

function sess_read($key) {
        echo "session read called<br>";
        return true;
}

function sess_write($key, $val) {
        echo "session write called<br>";
        return true;
}

function sess_destroy($key) {
        echo "session destroy called<br>";
        return true;
}

function sess_gc($maxlifetime) {
        echo "session gc called<br>";
        return true;
}

session_set_save_handler(
        "sess_open",
        "sess_close",
        "sess_read",
        "sess_write",
        "sess_destroy",
        "sess_gc");

class session{
 Function Session() {
                global $sessionActual;

                session_start();
                session_register( sessionActual );
        }
 Function addHistory( ) { 
                global $sessionActual;

                if ( !isset( $sessionActual ) )
                        $sessionActual = 0;
                else
                        $sessionActual += 1;
         }
}

$my_session = new session();
$my_session->addHistory();
?>

configured with:
'./configure' '--with-mysql' '--with-apxs' '--enable-trans-sid'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-23 03:23 UTC] joey at cvs dot php dot net
This bug is still there on version 4.0.1pl2 and latest CVS.
From what I can tell, call_user_func("sess_write") DOES
eventually get called, but it seems that we have already
closed the stream to the browser by that point.

I spent a/b 3 days digging at this one, and just cannot
seem to make any headway. Can anyone give me a
hand on this (Zeev? Sascha? Andi? Anyone?)
 [2000-07-25 18:06 UTC] joey@php.net
Session write stuff is called on module cleanup, which is why nothing gets
sent to the browser. Write handlers are fixed in CVS. Thanks.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Feb 03 11:03:46 2023 UTC