Giancarlo Pinerolo wrote:
> The manual has many cautions that say 'do not use session_regiister,,
> session_is_registered, session_unregister, when the ini setting is
> register_globals=off.
>
> But they still do work, it seems.
> Or how exactly  do these function work differently than with
> reg_globals On?
> Can I still continue to use them with reg_globals=off, as they seem to
> work anyway?

If you have register_globals set to off, the $_SESSION array is defined.

The functions session_is_registered, session_unregister and session_register
use the session file, not the $_SESSION array. That means that the function
session_unregister or session_register affects the session file, but not the
$_SESSION array!

That can lead to unwanted results if you check that value later on (in the
same php file). If you use unset($_SESSION['key']) instead of
session_unregister('key'), the value will be removed from the $_SESSION
array AND from the session file.

I recommend following the manual and don't use the session_unregister,
session_is_registered and session_register functions anymore.

HTH
Erwin


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

Reply via email to