Bug #49098 [Com]: Using custom session handler causes segfault in session_save_state
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] s...@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] s...@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] t...@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.orig2009-07-17 13:17:25.0 +0100 +++ ext/mysqli/mysqli.c 2009-11-12 07:10:19.054055576 + @@ -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] ras...@php.net Should be fixed now in svn. Please verify. [2009-11-12 01:09:16] s...@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
#49098 [Com]: Using custom session handler causes segfault in session_save_state
ID: 49098 Comment by: ulf at ladb dot unm dot edu Reported By: bugs at timj dot co dot uk Status: Open Bug Type: Session related Operating System: Linux PHP Version: 5.2.10 New Comment: Hi, Is this bug still under investigation? Just wondering because 5.2.9 is the last version of PHP that works with Wordpress/MySQL without crashing Apache. Thanks. Previous Comments: [2009-09-16 18:19:08] sriram dot natarajan at gmail dot com i just took the latest php snapshot from http://snaps.php.net and tried it out. if you notice, my script is just a completion of your script - i just filled in some missing pieces in your script - like creating the table etc . i am also using mysql 5.1.30 [2009-09-16 06:01:10] t...@php.net sriram: a) can you specify exactly which snapshot you use so that I can confirm/deny what you say b) did you try my test script? what does that do? why did you make up a new one? [2009-09-16 02:26:55] sriram dot natarajan at gmail dot com i just tried a simple php with mdb2/http_session2 with the latest php snapshot and was not able to reproduce this issue. is there some thing else required to reproduce this issue ? here is the simple script that i had to try it out loadModule('Manager'); $mdb2->loadModule('Extended'); $db = $mdb2->connect($dsn); $table_fields = array ( 'id' => array( 'type' => 'text', 'length' => '32'), 'data' => array( 'type' => 'text', 'length' => '32'), 'skey' => array( 'type' => 'text', 'length' => '32'), 'expiry' => array( 'type' => 'integer', 'notnull' => 1, 'unsigned' => 0), ); $table_constraints = array( 'primary' => true, 'fields' => array ( 'id' => array()), ); $s = $mdb2->createTable('session_data', $table_fields); if (PEAR::isError($s)) { die($s->getMessage() . ', ' . $s->getDebugInfo()); } $mdb2->createConstraint('session_data', 'primary_key',$table_constraints); $mdb2->createSequence('primary_key'); $options = array(); $options['dsn'] = $dsn; $options['table'] = 'session_data'; HTTP_Session2::setContainer('MDB2', $options); HTTP_Session2::start('MySESS'); HTTP_Session2::set('variable', 'The string'); ?> [2009-09-04 11:30:40] t...@php.net Further info: the crash does NOT occur if the DSN string is changed to "mysql://..." instead of "mysqli://..." (this also seemed to be the case in similar bug #48922) [2009-08-11 22:00:51] t...@php.net OK, for the record then, that case was reproducible for me with 5.2.11-dev snap 200908101630. Backtrace similar to the first one opening the bug. 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/49098 -- Edit this bug report at http://bugs.php.net/?id=49098&edit=1
#49098 [Com]: Using custom session handler causes segfault in session_save_state
ID: 49098 Comment by: sriram dot natarajan at gmail dot com Reported By: bugs at timj dot co dot uk Status: Open Bug Type: Session related Operating System: Linux PHP Version: 5.2.10 New Comment: i just took the latest php snapshot from http://snaps.php.net and tried it out. if you notice, my script is just a completion of your script - i just filled in some missing pieces in your script - like creating the table etc . i am also using mysql 5.1.30 Previous Comments: [2009-09-16 06:01:10] t...@php.net sriram: a) can you specify exactly which snapshot you use so that I can confirm/deny what you say b) did you try my test script? what does that do? why did you make up a new one? [2009-09-16 02:26:55] sriram dot natarajan at gmail dot com i just tried a simple php with mdb2/http_session2 with the latest php snapshot and was not able to reproduce this issue. is there some thing else required to reproduce this issue ? here is the simple script that i had to try it out loadModule('Manager'); $mdb2->loadModule('Extended'); $db = $mdb2->connect($dsn); $table_fields = array ( 'id' => array( 'type' => 'text', 'length' => '32'), 'data' => array( 'type' => 'text', 'length' => '32'), 'skey' => array( 'type' => 'text', 'length' => '32'), 'expiry' => array( 'type' => 'integer', 'notnull' => 1, 'unsigned' => 0), ); $table_constraints = array( 'primary' => true, 'fields' => array ( 'id' => array()), ); $s = $mdb2->createTable('session_data', $table_fields); if (PEAR::isError($s)) { die($s->getMessage() . ', ' . $s->getDebugInfo()); } $mdb2->createConstraint('session_data', 'primary_key',$table_constraints); $mdb2->createSequence('primary_key'); $options = array(); $options['dsn'] = $dsn; $options['table'] = 'session_data'; HTTP_Session2::setContainer('MDB2', $options); HTTP_Session2::start('MySESS'); HTTP_Session2::set('variable', 'The string'); ?> [2009-09-04 11:30:40] t...@php.net Further info: the crash does NOT occur if the DSN string is changed to "mysql://..." instead of "mysqli://..." (this also seemed to be the case in similar bug #48922) [2009-08-11 22:00:51] t...@php.net OK, for the record then, that case was reproducible for me with 5.2.11-dev snap 200908101630. Backtrace similar to the first one opening the bug. [2009-08-11 05:16:26] j...@php.net NEVER ever email me privately test cases. Here's the script you sent me: Installed PEAR packages to make it happen: HTTP_Session2 0.7.2 beta MDB2 2.5.0b2 beta MDB2_Driver_mysqli 1.5.0b2 beta 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/49098 -- Edit this bug report at http://bugs.php.net/?id=49098&edit=1
#49098 [Com]: Using custom session handler causes segfault in session_save_state
ID: 49098 Comment by: sriram dot natarajan at gmail dot com Reported By: bugs at timj dot co dot uk Status: Open Bug Type: Session related Operating System: Linux PHP Version: 5.2.10 New Comment: i just tried a simple php with mdb2/http_session2 with the latest php snapshot and was not able to reproduce this issue. is there some thing else required to reproduce this issue ? here is the simple script that i had to try it out loadModule('Manager'); $mdb2->loadModule('Extended'); $db = $mdb2->connect($dsn); $table_fields = array ( 'id' => array( 'type' => 'text', 'length' => '32'), 'data' => array( 'type' => 'text', 'length' => '32'), 'skey' => array( 'type' => 'text', 'length' => '32'), 'expiry' => array( 'type' => 'integer', 'notnull' => 1, 'unsigned' => 0), ); $table_constraints = array( 'primary' => true, 'fields' => array ( 'id' => array()), ); $s = $mdb2->createTable('session_data', $table_fields); if (PEAR::isError($s)) { die($s->getMessage() . ', ' . $s->getDebugInfo()); } $mdb2->createConstraint('session_data', 'primary_key',$table_constraints); $mdb2->createSequence('primary_key'); $options = array(); $options['dsn'] = $dsn; $options['table'] = 'session_data'; HTTP_Session2::setContainer('MDB2', $options); HTTP_Session2::start('MySESS'); HTTP_Session2::set('variable', 'The string'); ?> Previous Comments: [2009-09-04 11:30:40] t...@php.net Further info: the crash does NOT occur if the DSN string is changed to "mysql://..." instead of "mysqli://..." (this also seemed to be the case in similar bug #48922) [2009-08-11 22:00:51] t...@php.net OK, for the record then, that case was reproducible for me with 5.2.11-dev snap 200908101630. Backtrace similar to the first one opening the bug. [2009-08-11 05:16:26] j...@php.net NEVER ever email me privately test cases. Here's the script you sent me: Installed PEAR packages to make it happen: HTTP_Session2 0.7.2 beta MDB2 2.5.0b2 beta MDB2_Driver_mysqli 1.5.0b2 beta [2009-07-29 12:31:10] j...@php.net And as expected: We really need proper, short, reproducing script. Now the problem might be anywhere.. [2009-07-29 12:30:18] j...@php.net In the future: PLEASE add the backtraces in separate comments. Now it's pretty hard to see which is which. 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/49098 -- Edit this bug report at http://bugs.php.net/?id=49098&edit=1