|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18031 PHP engine runs user-based read and disconnect functions when open return false
Submitted: 2002-06-27 19:51 UTC Modified: 2002-10-20 23:15 UTC
From: nbrandon at hotmail dot com Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.1.2 OS: Win ME
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: nbrandon at hotmail dot com
New email:
PHP Version: OS:


 [2002-06-27 19:51 UTC] nbrandon at hotmail dot com
I have created my own session handler using both a function and class based approach. On both occasions, when the "open" function returns a failure - "return false;", PHP engine tries to run both the "read" and "disconnect" functions. This causes a fatal error as shown below.

Fatal error: Call to undefined function: query() in f:\cvs_dev\Neutec\website\\site\include\ on line 139

Fatal error: Call to undefined function: disconnect() in f:\cvs_dev\Neutec\website\\site\include\ on line 109

On both lines, PHP is trying to connect to the database using a database handler variable, and since the variable has not been initialised (because the "open" function failed), these fatal errors occur.

If the PHP engine could not "open" a session, then it should not try and "read" or "disconnect" a session on exiting.

Full source code can be supplied on request.

Many Thanks


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 06:01 UTC] nbrandon at hotmail dot com
Just looked at the code for php4/ext/session/session.c revision 1.310.

I'm no real coder but, I believe the area of code thats causing the problem is

static void php_session_initialize(TSRMLS_D)
	char *val;
	int vallen;

	/* Open session handler first */
	if (PS(mod)->open(&PS(mod_data), PS(save_path), PS(session_name) TSRMLS_CC) == FAILURE) {
		php_error(E_ERROR, "Failed to initialize session module");

I believe the return should read

return FAILURE;

I could be completely way-off - but thats my 2-cents.
 [2002-09-29 13:46 UTC]
Please try using this CVS snapshot:
For Windows:

 [2002-09-30 03:54 UTC] nbrandon at hotmail dot com
Will not be able to test the new snapshots until a couple of weeks time.
 [2002-09-30 18:22 UTC]
Keeping at "feedback" status until requested feedback is got.

 [2002-10-20 23:15 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Sun Apr 02 03:03:39 2023 UTC