|  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: Assigned: arpad (profile)
Status: Closed Package: Session related
PHP Version: trunk-SVN-2011-09-14 (SVN) OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
43 + 20 = ?
Subscribe to this entry?

 [2011-09-14 05:50 UTC]
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


Add a Patch

Pull Requests

Add a Pull Request


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

 [2011-09-14 10:36 UTC]
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]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Feb 02 12:05:53 2023 UTC