php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13507 Destroy handler in session_set_save_handler doesn't work
Submitted: 2001-10-02 04:13 UTC Modified: 2001-12-19 22:47 UTC
From: al77_t at yahoo dot co dot uk Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.0.6 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: al77_t at yahoo dot co dot uk
New email:
PHP Version: OS:

 

 [2001-10-02 04:13 UTC] al77_t at yahoo dot co dot uk
I've taken this script from documentation provided with php.

error_log function writes its first parameter to a file.

I've found that  all handlers works perfectly except destroy handler.

Here is the script:
--------------------------------------
<?
function open ($save_path, $session_name) {
  error_log (" started session \$save_path=$save_path, \$session_name=$session_name", 0);
  return(true);
}

function close() {
    error_log (" close session \$save_path=".session_save_path().", \$session_name=".session_name(), 0);
    return(true);
}

function read ($id) {
   error_log (" read session \$id=$id,\$save_path=".session_save_path().", \$session_name=".session_name(), 0);
	return true;
}

function write ($id, $sess_data) {
 error_log (" write session \$id=$id,\$sess_data=$sess_data,\$save_path=".session_save_path().", \$session_name=".session_name(), 0);
	return true;
}

function sess_destroy ($id) {
	error_log (" destroy session \$id=$id,\$sess_data=$sess_data,\$save_path=".session_save_path().", \$session_name=".session_name(), 0);
	return true;
}
function gc ($maxlifetime) {
  error_log (" gc session \$save_path=".session_save_path().", \$session_id=".session_id()." \$session_name=".session_name(), 0);
  return true;
}
session_set_save_handler ('open', 'close', 'read', 'write', 'sess_destroy', 'gc');
session_start();
?>
------------------------------------------------------


And here is a my php.ini (i have stripped all commented lines from it)

-------------------------------------------------------
[PHP]
engine = On
short_open_tag = On
asp_tags = Off
precision    =  14
y2k_compliance = Off
output_buffering = Off
output_handler =
zlib.output_compression = Off
implicit_flush = Off
allow_call_time_pass_reference = On
safe_mode = Off
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
highlight.string  = #CC0000
highlight.comment = #FF9900
highlight.keyword = #006600
highlight.bg      = #FFFFFF
highlight.default = #0000CC
highlight.html    = #000000
expose_php = On

max_execution_time = 30     ; Maximum execution time of each script, in seconds
memory_limit = 8M      ; Maximum amount of memory a script may consume (8MB)

error_reporting  =  E_ALL & ~E_NOTICE
display_errors = On
log_errors = on
track_errors = On
error_prepend_string = "<font color=ff0000>"
error_append_string = "</font>"
error_log = c:\php_test.txt
warn_plus_overloading = Off

variables_order = "EGPCS"
register_globals = On
register_argc_argv = On
post_max_size = 8M
gpc_order = "GPC"

magic_quotes_gpc = On
magic_quotes_runtime = Off    
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"

doc_root =
user_dir =
extension_dir = "c:\program files\php\extensions"

enable_dl = On

file_uploads = On
upload_max_filesize = 2M

allow_url_fopen = On
extension="php_printer.dll"
extension="php_webmail.dll"

[Syslog]
define_syslog_variables  = On

[mail function]
SMTP = 192.165.0.1
sendmail_from = me@localhost.com


[SQL]
sql.safe_mode = Off

odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1  
odbc.defaultlrl = 4096  
odbc.defaultbinmode = 1  

[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =

[bcmath]
bcmath.scale = 0

[Session]
; Handler used to store/retrieve data.
session.save_handler = user
session.save_path = C:\\temp
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.serialize_handler = php
session.gc_probability = 1
session.gc_maxlifetime = 3
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 1
session.use_trans_sid = 1
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Sockets]
sockets.use_system_read = On
------------------------------------------------------

Thank you.
Alex.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-19 22:47 UTC] yohgaki@php.net
Your session handler has bugs.
Search zend.com code exchange for PosrgreSQL session save handler for a example session handler. (It's under HTTP category)

--
Yasuo
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 06 06:01:29 2025 UTC