Jump to content


This topic is now archived and is closed to further replies.


session.bug_compat_42 or session.bug_compat_warn

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

$username = $HTTP_POST_VARS['username'];
$HTTP_SESSION_VARS["username"] = $username;[/b]

Thanks in advance.

Share this post

Link to post
Share on other sites
Don't use $HTTP_ xxx or session_register() which relies on register_globals being on.

$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]

Share this post

Link to post
Share on other sites


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.