Jump to content


Photo

session.bug_compat_42 or session.bug_compat_warn


  • Please log in to reply
1 reply to this topic

#1 jpistone

jpistone
  • Members
  • Pip
  • Newbie
  • 7 posts

Posted 22 May 2006 - 02:57 AM

My hosting company recently upgraded to PHP 4.4.2, and I'm now receiving the following message:

Warning: Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0

I've fixed the code to make things work okay, but the message still appears only once at the start of a session, and only when the browser (Firefox's most recent release for XP and Mac OS X) is restarted. If I log out and destroy session variables, I get no message...only when I restart the browser and the php script starts a session. Is this just a general warning regarding deprecaded code or is it pointing to something in my code that it doesn't find compatible? Variables are registered appropriately (I think)....

session_start();
$username = $HTTP_POST_VARS['username'];
session_register("username");
$HTTP_SESSION_VARS["username"] = $username;


Thanks in advance.

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 22 May 2006 - 04:23 AM

Don't use $HTTP_ xxx or session_register() which relies on register_globals being on.

Example:
session_start();
$username = isSet($_POST['username']) ? $_POST['username'] : '';
$_SESSION['username'] = $username;

[a href=\"http://us2.php.net/manual/en/reserved.variables.php#reserved.variables.session\" target=\"_blank\"]http://us2.php.net/manual/en/reserved.vari...riables.session[/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users