ID:               24252
 User updated by:  jpenn at cheetah-soft dot com
 Reported By:      jpenn at cheetah-soft dot com
-Status:           No Feedback
+Status:           Open
 Bug Type:         Session related
 Operating System: RHAT 7
 PHP Version:      4.3.1
 New Comment:

Ok - I thought the first post was clear.

When using session_set_save_handler() inside a class when using a DB as
the storage medium - you must connect to the DB inside of the open
function/method. First, we set the methods to use:

session_set_save_handler( array( &$this, 'open' ), array( &$this,
'close' ), array( &$this, 'read' ), array( &$this, 'write' ), array(
&$this, 'destroy' ), array( &$this, 'gc' ) );

Now, this is the open method:

function open( $blah, $blah )
{
      $res = mysql_connect( 'blah', 'blah', 'blah' );
      mysql_select_db( 'blah', $res );
      return( true );
}

The above works. When explicitly connecting inside of the open method -
everything works like a charm.

Now, if you DO NOT EXPLICITLY CONNECT (to the DB) inside of this method
- the session handler will not work. This is just not specific to one
DB and (or) operating system, it is a problem accross a magnitude of
platforms.

Is this a scope issue?


Previous Comments:
------------------------------------------------------------------------

[2003-06-26 18:23:57] [EMAIL PROTECTED]

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.



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

[2003-06-19 00:31:59] [EMAIL PROTECTED]

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.


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

[2003-06-18 23:57:03] jpenn at cheetah-soft dot com

Description:
------------
When connecting to the database inside the class object, everything
works fine with session_set_save_handler(). But, when connecting
outside of the class that holds the methods, php does'nt recognize
there is an active connection to the DB. Is this a known problem that I
have overlooked in the bug db?

I have tried everything, including passing the res id of the connection
into the session handler class but to no avail.

~ Thanks



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


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

Reply via email to