Re: [PHP] Re: Multiple session_start()s / Is it a problem??

2004-11-12 Thread Curt Zirzow
* Thus wrote elixon:
 I guess that session_id() method will return null if session is not 
 started (not tested) so theoreticaly you can use:
 
 if (!session_id()) session_start();

This is the best method.  relying that $_SESSION is set could
falsify your reliance that the session has been started. For
example, some code may be trying to clear all session data prior to
this with:

  $_SESSION = array(); 

Even though it is really set it doesn't mean that the session has
truely started.


Curt
-- 
Quoth the Raven, Nevermore.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Multiple session_start()s / Is it a problem??

2004-11-10 Thread elixon
I guess that session_id() method will return null if session is not 
started (not tested) so theoreticaly you can use:

if (!session_id()) session_start();
elixon
Al wrote:
Is there a problem issuing multiple session_start()s for a given script?
I can't find anything in the manual that says one way or the other.
I have some scripts that call more than one functions include file and 
for convenience put a session_start() on each one.

This gives me a Notice error.
Of course I can simply use @session_start() to negate the Notice; but, 
I want to be certain this is good practice.

Al.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Multiple session_start()s / Is it a problem??

2004-11-10 Thread elixon
And I think that $_SESSION does not exist unless session is started =
if (!is_array($_SESSION)) session_start();
might do the job as well.
elixon
Al wrote:
Is there a problem issuing multiple session_start()s for a given script?
I can't find anything in the manual that says one way or the other.
I have some scripts that call more than one functions include file and 
for convenience put a session_start() on each one.

This gives me a Notice error.
Of course I can simply use @session_start() to negate the Notice; but, 
I want to be certain this is good practice.

Al.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php