php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55690 Wrong behavior of sessionHandler
Submitted: 2011-09-14 05:50 UTC Modified: 2012-03-09 16:54 UTC
From: laruence@php.net Assigned: arpad (profile)
Status: Closed Package: Session related
PHP Version: trunk-SVN-2011-09-14 (SVN) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2011-09-14 05:50 UTC] laruence@php.net
Description:
------------
in mod_use_class.c

there is a macro:
#define PS_SANITY_CHECK                     \
    if (PS(default_mod) == NULL) {              \
        php_error_docref(NULL TSRMLS_CC, E_CORE_ERROR, "Called default 
SessionHandler but session.save_handler is user"); \
        RETURN_FALSE;                       \
    }    

but I think this is wrong. 

since, the default session.save_handler is "file", and if no new 
session.save_handler provide, PS(default_mod) will alyways be NULL(since 
default_mod only be assign in OnUpdateSaveHandler

Test script:
---------------
php -dsession.save_handler=files  -r 'var_dump(ini_get("session.save_handler")); $x=new SessionHandler; $x->gc(1);' 

Actual result:
--------------
PHP Fatal error:  SessionHandler::gc(): Called default SessionHandler but 
session.save_handler is user in Unknown on line 0

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-14 05:52 UTC] laruence@php.net
-Assigned To: +Assigned To: arpad
 [2011-09-14 05:52 UTC] laruence@php.net
arpad plz look at this. thanks
 [2011-09-14 05:57 UTC] laruence@php.net
I think you can remove the PS_SANITY_CHECK, and use PS(mod) instead of 
PS(default_mod), this should be okey. 

thanks
 [2011-09-14 10:36 UTC] arpad@php.net
SessionHandler isn't intended to work in any other context than session_set_save_handler($handler). I'd be nervous about making such a change now anyway.

However that error message is misleading. I'll update it.
 [2012-03-09 16:54 UTC] arpad@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 06:01:29 2024 UTC