Jump to content

error with sessions


yoshida

Recommended Posts

I get this error when I save a variable to a session, what does it mean and what should I do?

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 use PHP 4.4.2. Variables are saved to a session using
$variable=$_POST['fieldname'];session_register('fieldname');

and read from a session using

$variable=$_SESSION['fieldname']

When I refresh the page all is OK and everything works fine, but this is just anoying. Do I use the wrong syntax for this PHP version, or should I adapt a config file for PHP or Apache? Please help me. I try my very best to understand how php programming works.EDIT: got it. session_register is (unsafe) old school. I use the new way right now, which I can't look up at the moment. No errors for now.

Link to comment
Share on other sites

I never had this error, but you might want to try it without using session_register()Just use $_SESSION = ;edit:Ah you discovered that already :)

Like this? $_SESSION['ctyp'] = $ctyp; :)@dcole: did that, disregarding the config file's warning. Meh, it's just an intranet solution, so who cares.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...