ID:               38241
 Updated by:       [EMAIL PROTECTED]
 Reported By:      qw_kerry at yahoo dot com dot cn
-Status:           Open
+Status:           Feedback
 Bug Type:         Session related
 Operating System: Windows 2003
 PHP Version:      5CVS-2006-07-28 (snap)
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------

[2006-07-28 09:26:01] qw_kerry at yahoo dot com dot cn

Description:
------------
I use session_set_save_handler() to define my own session handler. It
can read session values, but can't write them. But the function work
well when I run my script on php 5.1.4. 

Session is stored in database in my script. When I store session in
files, session is written well.

Reproduce code:
---------------
The functions except for DBSessionWrite are omitted. PDO_MYSQL is
used.

function DBSessionWrite($aKey,$aVal)
{
        global $_sessiondb,$_sessiontable;
        $sql = "SELECT lastupdated FROM ".$_sessiontable." WHERE
sessionid=?";
        $stmt = $_sessiondb->prepare($sql);
        $stmt->execute($aKey);
        if($stmt->fetchColumn()) {
                $sql = "UPDATE ".$_sessiontable." SET datavalue=?, lastupdated=?
WHERE sessionid=?";
                $stmt = $_sessiondb->prepare($sql);
                $stmt->execute(array($aVal,time(),$aKey));
        }
        else {
                $sql = "INSERT INTO ".$_sessiontable." VALUES (?,?,?)";
                $stmt = $_sessiondb->prepare($sql);
                $stmt->execute(array($aKey,time(),$aVal));
        }
        return $stmt->rowCount();
}


session_set_save_handler("DBSessionOpen", "DBSessionClose",
"DBSessionRead", "DBSessionWrite", "DBSessionDestroy", "DBSessionGC");
session_start();

$session_idencode = md5($_SERVER["REMOTE_ADDR"]);
if($session_idencode != $_SESSION['idencode']) {
        session_regenerate_id(true);
        $_SESSION['idencode'] = $session_idencode;
}

Expected result:
----------------
One new row should appear in the session table.

Actual result:
--------------
No new row appear.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=38241&edit=1

Reply via email to