The execution of the script doesn't generate the file /tmp/file.log
...???
>>> Derick Rethans <d.rethans@jdimedia.nl> 09:57:44
17/08/2000 >>>
On 17 Aug 2000
perceau@eram.fr wrote:
> From:
perceau@eram.fr > Operating
system: Redhat Linux 6.2
> PHP version: 4.0.1pl2
> PHP Bug Type:
Session related
> Bug description: session_set_save_handler() misfunction
>
> 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 ?
It is called, but after the link to the browser has been
closed. To see
this, try writing to a file, instead of a print statement.
Derick Rethans
JDI Media Solutions