PHP: Deprecated session_is_registered and session_unregister

Today i found in a older website i administrate some messages in the Apache error logfiles.

They looked like this:

PHP Deprecated: Function session_is_registered() is deprecated
PHP Deprecated: Function session_unregister() is deprecated

I searched the web and found this replacement code:

//session_is_registered($var);
array_key_exists($variable, $_SESSION);

and

//session_unregister($var)
unset($_SESSION[$var]);

I hope this might help someone.

Hint:
Do not use isset() here, because it might be wrong!
PHP - Benchmark isset() or array_key_exists() ?

No related posts.


 
 
 

Die Kommentarfunktion zu diesem Beitrag wurde deaktiviert.