Check for start_sessoin without causing header problems
| From: | SLanger at spirit21 dot de | Date: | Sat, 18 Jan 2003 11:50:02 +0000 |
| Subject: | Check for start_sessoin without causing header problems | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132086@lists.php.net to get a copy of this message | ||
Hello
I checked the PHP manual and couldn't find anything on this...
When I call session_register() an implicit call to session_start() is
executed. So if the session handling uses cookies to track the session and
the call to session_register() is not before any output this will cause a
header allready sent problem. Is this correct?
If so how can I call a register session from within a class and make sure
that the session is allready active and if not just print a warning.
For background information: The class mentioned above is part of a
classlib used by others and I can not guarantee that they call
session_start since I have no controll over how my class lib gets
included.
So the issue here is if it is possible to create a backup for this problem
or if I just have to rely on the user of the classlib to understand the
mechanisms of session tracking.
Any ideas on this? What do you consider best practice in this matter?
Thanks for all the advice I have received so far
Stefan