Bug #49098 [Com]: Using custom session handler causes segfault in session_save_state

From: Date: Sun, 24 Oct 2010 22:07:20 +0000
Subject: Bug #49098 [Com]: Using custom session handler causes segfault in session_save_state
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155487@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49098&edit=1

 ID:                 49098
 Comment by:         nn at tronix dot pl
 Reported by:        bugs at timj dot co dot uk
 Summary:            Using custom session handler causes segfault in
                     session_save_state
 Status:             Closed
 Type:               Bug
 Package:            Session related
 Operating System:   Linux
 PHP Version:        5.2.10
 Block user comment: N

 New Comment:

I think the BUG still exists.
I have custom session handler based on PostgreSQL queries.
Any version above 5.2.9 segfaults immediately after I open the
application in the browser.
As soon as custom session handler is disabled - everything is working
fine.

I think that mb_string is important here, not mssql.

Brgs
Norbert


Previous Comments:
------------------------------------------------------------------------
[2009-11-12 17:48:36] svn@php.net

Automatic comment from SVN on behalf of johannes
Revision: http://svn.php.net/viewvc/?view=revision&revision=290608
Log: Merge 290570 (Fix bug #49098). (Rasmus)

------------------------------------------------------------------------
[2009-11-12 08:20:57] svn@php.net

Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=290573
Log: Fix for bug #49098

------------------------------------------------------------------------
[2009-11-12 07:16:03] timj@php.net

Confirmed works for me. Below tested on PHP 5.2 which also seems to work
- could you fix it on that branch too?:

--- ext/mysqli/mysqli.c.orig	2009-07-17 13:17:25.000000000 +0100
+++ ext/mysqli/mysqli.c	2009-11-12 07:10:19.054055576 +0000
@@ -1003,7 +1003,11 @@
 	if (MyG(error_msg)) {
 		efree(MyG(error_msg));
 	}
-	MyG(error_msg) = estrdup(mysql_err);
+	if(mysql_err && *mysql_err) {
+		MyG(error_msg) = estrdup(mysql_err);
+	} else {
+		MyG(error_msg) = NULL;
+	}
 }
 /* }}} */

Many thanks Rasmus (and to Jani/Sriram for your help). 

------------------------------------------------------------------------
[2009-11-12 01:10:33] rasmus@php.net

Should be fixed now in svn.  Please verify.

------------------------------------------------------------------------
[2009-11-12 01:09:16] svn@php.net

Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=290570
Log: Fix bug #49098

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=49098


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49098&edit=1


Thread (38 messages)

« previous php.bugs (#155487) next »