From: 0809 at 21cn dot com Operating system: linux as4 PHP version: 5.3.0 PHP Bug Type: Session related Bug description: session_set_save_handler cann't get global variable(instance of object)
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 bug report at http://bugs.php.net/?id=50154&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50154&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50154&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50154&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50154&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50154&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50154&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50154&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50154&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50154&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50154&r=support Expected behavior: http://bugs.php.net/fix.php?id=50154&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50154&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50154&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50154&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50154&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50154&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50154&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50154&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50154&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50154&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50154&r=mysqlcfg