Question about Warning in the PHP Manual

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Galt
Forum Newbie
Posts: 18
Joined: Thu May 22, 2003 8:08 am

Question about Warning in the PHP Manual

Post by Galt »

The PHP manual says:

Code: Select all

If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
Found here

Anybody know why we shouldn't do that? It works just fine (had to change it once I read the warning though), and I'm not sure why they don't want it used that way.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

session_register() only works with register_globals on and is thus deprecated along with register_globals. You shouldn't have to use either it or session_is_registered() etc. any more as $_SESSION and isset() do the job better.

To answer the specific question though - generally $_SESSION and the old session functions don't play nicely together and normally if you use both the sessions won't work.

Mac
Post Reply