jpistone Posted May 22, 2006 Share Posted May 22, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/10159-sessionbug_compat_42-or-sessionbug_compat_warn/ Share on other sites More sharing options...
toplay Posted May 22, 2006 Share Posted May 22, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/10159-sessionbug_compat_42-or-sessionbug_compat_warn/#findComment-37878 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.