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

Sniper - the example is in my last post. Also:

[quote]
(of course you have to
connect to the database...)
[/quote]
Where did you come up with that? Who in there right mind would think
you would not have to connect to the DB? The whole bug can be summed up
with that small quote.

If you DO NOT CONNECT TO THE DB WITHIN THE OPEN METHOD - it will not
work.

- It will not work if you connect outside of the class
- It will not work if you connect inside the class but in a method
other than the sess_open method
- It will not work if you connect with a DB commection class

It will ONLY WORK if you connect inside the open method for that
function - the session_set_save_handler() function.

Excuse me for getting fustrated - but this was almost a simple bug
report, and very understandable from my first post. This is almost as
simple to understand as anything else the langauge has to offer.

~ Thanks


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

[2003-07-07 19:42:19] [EMAIL PROTECTED]

Either I don't understand what you mean with this or you're just
expecting some weird magic to happen there. (of course you have to
connect to the database...)

Provide a FULL but short example script if you still think this is some
bug.



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

[2003-06-27 03:02:48] jpenn at cheetah-soft dot com

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?

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

[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