php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6207 session_set_save_handler() misfunction
Submitted: 2000-08-17 03:22 UTC Modified: 2000-08-17 16:22 UTC
From: perceau at eram dot fr Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.1pl2 OS: Redhat Linux 6.2
Private report: No CVE-ID: None
 [2000-08-17 03:22 UTC] perceau at eram dot fr
I've written the following PHP script to test storing session datas into an Oracle 8i database :

<? 

function sess_open($save_path, $session_name) { 
    return true; 
} 

function sess_close() { 
    return true; 
} 

function sess_read($key) { 

    print "READ !"; 
    include("oci8.inc"); 
    $db=new DB; 
    $db->connect(); 
    $db->query("SELECT value FROM php_sessions WHERE sesskey = '$key' AND expiry > " . time()); 

    if (list($value) = $db->FetchRow()) { 
        return $value; 
    } 

    return false; 
} 

function sess_write($key, $val) { 

    print "WRITE!"; 
    include("oci8.inc"); 
    $db=new DB; 
    $db->connect(); 
    $expiry = time() + $SESS_LIFE; 
    $value = addslashes($val); 

    $db->Query("INSERT INTO php_sessions VALUES ('".$key."',".$expiry.",'".$value."'"); 
    return true; 
} 

function sess_destroy($key) { 

    include("oci8.inc"); 
    $db=new DB; 
    $db->connect(); 
    $db->Query("DELETE FROM php_sessions WHERE sesskey = '".$key."'"); 
    return  true; 
} 

function sess_gc($maxlifetime) { 
    include("oci8.inc"); 
    $db=new DB; 
    $db->connect(); 
    $db->Query("DELETE FROM sessions WHERE expiry < " . time()); 
    return true; 
} 

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

session_register("toto"); 
$toto=55; 
?> 


After submitting it, the only thing that display on the IE 5.5 is READ!

Why doesn't the session_write function be called ?

Regards

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-17 16:22 UTC] sas@php.net
Write/Close are called after the request finishes, hence you don't see any
output from these handlers.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 02:01:29 2024 UTC