php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48922 session_set_save_handler() appears to cause all processing to stop
Submitted: 2009-07-14 19:48 UTC Modified: 2009-07-29 12:25 UTC
Votes:5
Avg. Score:4.4 ± 0.8
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:0 (0.0%)
From: bobby at indesignfirm dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.2.10 OS: RedHat 2.6.9-42.0.8.EL #1
Private report: No CVE-ID:
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-07-14 19:48 UTC] bobby at indesignfirm dot com
Description:
------------
Server upgraded from 5.2.9 last night and suddenly any scripts using custom session set save handler has stopped working.

No errors reported, all processing just stops.

Un-commenting the code makes everything come back to life.

Reproduce code:
---------------
function open($savePath, $sessName) {
        return true;
    }
    
    function close() {
        return true;
    }
    
    function read($sessID) {
        //Lookup the session in the database
        $readquery = new QueryCall();
        $readquery->SetProcedureName('Session_GetData');
        $readquery->AddVariable('TEXT', $sessID);
        $readquery->ExecuteQuery();
      
        //Now return the data we get back from the database
        return $readquery->procedureResults[0]['d'];
    }
    
    function write($sessID,$sessData) {
        //Write the session data to the database
        $writequery = new QueryCall();
        $writequery->SetProcedureName('Session_WriteData');
        $writequery->AddVariable('TEXT', $sessID);
        $writequery->AddVariable('TEXT', time());
        $writequery->AddVariable('TEXT', $sessData);
        $writequery->ExecuteQueryNoResults();

        //Now return true just to keep it happy
        return TRUE;
    }
    
    function destroy($sessID) {
        //Destroy the session that we need to get rid of
        $destroyquery = new QueryCall();
        $destroyquery->SetProcedureName('Session_Destroy');
        $destroyquery->AddVariable('TEXT', $sessID);
        $destroyquery->ExecuteQueryNoResults();

        //Return True just to make everything happy
        return TRUE;
    }
    
    function gc($sessMaxLifeTime) {
        //Calculate what the time limit is
        $timelimit = time() - $sessMaxLifeTime;
        
        //Let's do some garbage collection
        $garbagequery = new QueryCall();
        $garbagequery->SetProcedureName('Session_GarbageCollection');
        $garbagequery->AddVariable('TEXT', $timelimit);
        $garbagequery->ExecuteQueryNoResults();
        
        //Return true just to make everything happy
        return TRUE;
    }

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

Expected result:
----------------
Session information should be stored in the database and has been working for several months now.  Since the upgrade of 5.2.10 it has stopped working.  No code changes have been made to application

Actual result:
--------------
Blank page.  Nothing returned.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-14 20:15 UTC] bobby at indesignfirm dot com
After more research it would seem that the problem lies within the read function using the mysqli_connect function.  If I change it to mysql_connect, processing continues, changing it back to mysqli_connect causes it to instantly fail with no further information.

However all other mysqli queries are running fine.
 [2009-07-15 12:09 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-07-29 12:25 UTC] jani@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 07:02:14 2014 UTC