|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5519 session handler and php4.0.1pl2 - missing write/close calls ?
Submitted: 2000-07-11 16:30 UTC Modified: 2000-07-12 08:24 UTC
From: kronos_2k at hotmail dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.1pl2 OS: Linux 2.2.13
Private report: No CVE-ID: None
 [2000-07-11 16:30 UTC] kronos_2k at hotmail dot com

The following script is from the php4 documentation 

function open ($save_path, $session_name) { 
echo "open ($save_path, $session_name)\n"; 
return true; 
function close () { 
echo "close\n"; 
return true; 
function read ($key) { 
echo "read ($key)\n"; 
return "foo|i:1;"; 
function write ($key, $val) { 
echo "write ($key, $val)\n"; 
return true; 
function destroy ($key) { 
return true; 
function gc ($maxlifetime) { 
return true; 

session_set_save_handler ("open", "close", "read", "write", "destroy", "gc"); 
echo $foo; 

On my computer at work running on php4.0 it executes perfectly
with the following output: 

open (/tmp, PHPSESSID) read (f4a6e6cb93bdb1b36fcedc7ea1283780) 1
write (f4a6e6cb93bdb1b36fcedc7ea1283780, foo|i:1;) 

On my computer at home running on php4.01pl2 (latest version I
think) the write and close function is never called: 

open (/tmp, PHPSESSID) read (2c0b4ffcf5076fa5b99cb93e672445e9) 1 

Both installations have identical php.ini files. The only difference is that
I included some more libraries at home.

Here's my current configure line:

'./configure' '--with-apxs=/usr/local/apache/bin/apxs'
                             '--with-mysql=/usr/local/mysql' '--with-zlib=/usr' '--with-gd=/usr/local'
                             '--with-png-dir=/usr/local' '--with-jpeg-dir=/usr/local' '--enable-ftp'
                             '--enable-track-vars' '--enable-magic-quotes' '--disable-debug'

I don't exactly know if it is a bug or just a misconfiguration. Maybe it's of some help to you.

See ya



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-12 08:24 UTC] sas at cvs dot php dot net
That is correct. The write/close handler are called after the request has finished, so no further data is sent to the output (in 4.0.1).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 14:01:29 2024 UTC