|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-12 08:29 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 09:00:02 2025 UTC |
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