Jump to content

session.bug_compat_42 or session.bug_compat_warn


jpistone

Recommended Posts

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

[b]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[/b]

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)....

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

Thanks in advance.
Link to comment
Share on other sites

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

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

[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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.