ID:               50154
 Updated by:       j...@php.net
 Reported By:      0809 at 21cn dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Session related
 Operating System: linux as4
 PHP Version:      5.3.0
 New Comment:

RTFM:

http://www.php.net/manual/en/function.session-set-save-handler.php

"As of PHP 5.0.5 the write  and close  handlers are called after object
destruction and therefore cannot use objects or throw exceptions. The
object destructors can however use sessions.

It is possible to call session_write_close() from the destructor to
solve this chicken and egg problem."



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

[2009-11-12 07:16:59] 0809 at 21cn dot com

Description:
------------
hi staff,
  In my programs of  my php5.3,i use function
"session_set_save_handler" to set the sessions into database,this
function must set the parameters:names of the functions like
:(open,close,read,write,destroy,gc) as string.
  when i use the functions :read,write,destroy,gc ,i set a global
variable(an instance of object) in them ,but i found it works normally
in these functions except in "write";i cann't get the value of the
variable,only appears in the "wirte" function.
  i change the version of php to < 5.3 like :4.x ¡¢5.2, the problem
above disappears.
  i don't know the reason.can you help me to find it out?

  jjjackie

Reproduce code:
---------------
ini_set('session.save_handler', 'user');
class a{
var $var_a = 'here';
function a(){
}
}
$v = new a();
function open($save_path,$session_name){        return true;}
function close(){       return true;}
function read($id){     return true;}
function write($id,$value){
        global $v;
        echo($v ->var_a);
}
function destroy($id){ return true; }
function gc(){ return true; }
session_set_save_handler('open','close','read','write','destroy','gc');
session_start();

Expected result:
----------------
here

Actual result:
--------------
Notice: Trying to get property of non-object in
/home/wwwroot/dgunion/inc/inc.session.php on line 182 


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


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

Reply via email to