ID:               25954
 Updated by:       [EMAIL PROTECTED]
 Reported By:      support at spill dot nl
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: RHL 8.0
 PHP Version:      4.3.3
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.

Verified in PHP 5.0.0, note removed.


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

[2003-10-22 11:47:50] support at spill dot nl

Description:
------------
The documentation at php.net for session_set_save_handler() states the
following note:

The write handler is not executed if the session contains no data; this
applies even if empty session variables are registered. This differs to
the default file-based session save handler, which creates empty
session files. 

http://php.net/session_set_save_handler


The documentation at Zend.com contains a similar statement. However the
most simple user session handler I can come up with reports the write
function being called with absolutely no registered variables.

I think this is good behaviour as the user session handler should
decide for itself what to do with empty data, but the documentation
should be fixed if this is expected behaviour.


Reproduce code:
---------------
<?php

// bogus session handler
function open($save_path,$session_name)         {
return(error_log("sess_open('".$save_path."','".$session_name."')",0));
}
function close()                                {
return(error_log("sess_close()",0)); }
function read($id)                              {
error_log("sess_read('".$id."')",0); return(""); }
function write($id,$sess_data)                  {
return(error_log("sess_write('".$id."','".$sess_data."')",0)); }
function destroy($id)                           {
return(error_log("sess_destroy('".$id."')",0)); }
function gc($maxlifetime)                       {
return(error_log("sess_gc('".$maxlifetime."')",0)); }

// install session handler
session_set_save_handler ("open", "close", "read", "write", "destroy",
"gc");

// start a session
session_start();

?>


Expected result:
----------------
I would expect the following lines in my logfile:

[22-Oct-2003 17:44:22] sess_open('/bigdisk/tmp/php','PHPSESSID')
[22-Oct-2003 17:44:22] sess_read('dd2340d600efe2925b4d8007ae8fbbd2')
[22-Oct-2003 17:44:22] sess_close()


Actual result:
--------------
However I find:

[22-Oct-2003 17:44:22] sess_open('/bigdisk/tmp/php','PHPSESSID')
[22-Oct-2003 17:44:22] sess_read('dd2340d600efe2925b4d8007ae8fbbd2')
[22-Oct-2003 17:44:22]
sess_write('dd2340d600efe2925b4d8007ae8fbbd2','')
[22-Oct-2003 17:44:22] sess_close()


The call to write() is unexpected as the documentation states it will
not be called under these circumstances.



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


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

Reply via email to