I have a third party script and was wondering how I can check with PHP
if session_start()
has been declared before doing something?
I suppose you could use the session_id function :
session_id()
returns the session id for the current session or the empty string ("") if there is no current session (no current session id exists).
Or maybe testing whether $_SESSION
is set or not, with isset, might do the trick, as it should not be set when no session has been started -- you just have to hope that nothing assigns anything to $_SESSION
without starting the session first.