[pmwiki-users] $_SESSION[] in ?action=diag

Joachim Durchholz jo at durchholz.org
Mon Jul 11 06:45:08 CDT 2005


Thomas -Balu- Walter wrote:
> On Fri, Jul 08, 2005 at 05:38:12PM -0500, Patrick R. Michaud wrote:
> 
>> Yes; for some reason PHP complains with a warning if session_start 
>> is called twice.  (Personally, I wish it would just be a no-op if 
>> the session has already started.

According to php.net, this warning was consciously introduced in one of
the more recent versions of PHP. (Don't ask me why...)

>> And I also wish there was a way to know if a session has already
>> started, but PHP doesn't seem to tell us that either.)
> 
> AFAIK $_SESSION equals (as in ===) NULL if the session was not
> started yet.

This works only if there was no previous session_write_close call in the 
current PHP run. session_write_close does *not* clear $_SESSION (there 
are valid reasons to do it that way).
PmWiki does call session_write_close on occasion, so it can't check 
isset($_SESSION) to know whether session_start was called.

> If it was started it is an (empty) array.

Not necessarily empty - it may contain values from the previous
session.

Regards,
Jo



More information about the pmwiki-users mailing list