From:             
Operating system: All
PHP version:      5.3.3
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:if bailout is called on rshutdown, session segfualt on next 
request

Description:
------------
session sets it's handlers to NULL at rshutdown.

in case of bailout in rshutdown (by other extension), this cleanup will not
happen and next request will segfault.



setting to NULL at RINIT works around the problem.

Test script:
---------------
<?php

function open($save_path, $session_name)

{

  global $sess_save_path;



  $sess_save_path = $save_path;

  return(true);

}



function close()

{

  return(true);

}



function read($id)

{

  global $sess_save_path;



  $sess_file = "$sess_save_path/sess_$id";

  return (string) @file_get_contents($sess_file);

}



function write($id, $sess_data)

{

  global $sess_save_path;



  $sess_file = "$sess_save_path/sess_$id";

  if ($fp = @fopen($sess_file, "w")) {

    $return = fwrite($fp, $sess_data);

    fclose($fp);

    return $return;

  } else {

    return(false);

  }



}



function destroy($id)

{

  global $sess_save_path;



  $sess_file = "$sess_save_path/sess_$id";

  return(@unlink($sess_file));

}



function gc($maxlifetime)

{

  global $sess_save_path;



  foreach (glob("$sess_save_path/sess_*") as $filename) {

    if (filemtime($filename) + $maxlifetime < time()) {

      @unlink($filename);

    }

  }

  return true;

}



session_set_save_handler("open", "close", "read", "write", "destroy",
"gc");



session_start();



// proceed to use sessions normally



?>






-- 
Edit bug report at http://bugs.php.net/bug.php?id=53295&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53295&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53295&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53295&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53295&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53295&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53295&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53295&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53295&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53295&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53295&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53295&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53295&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53295&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53295&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53295&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53295&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53295&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53295&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53295&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53295&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53295&r=mysqlcfg

Reply via email to