Jump to content

PHP Warning: Unknown(): Your script possibly relies on a session side-effect wh


ballhogjoni

Recommended Posts

My error is PHP Warning:  Unknown(): Your script possibly relies on a session side-effect which existed until PHP 4.2.3.

 

It says I can turn this off, but I don't want too. I want all errors and warnings to show so I can fix my code.

 

I found out my host just recently updated to 5.2 and I was coding on 4.3.

 

My question is how to I fix this warning?

I believe the whole error message mentions that this is a bug in php. The error should not be triggered if register_globals are off. Setting the bits (there are two related errors) to turn off the warning is acceptable.

 

The cause of this is the stupid register_globals code that wants to cross-populate program/post/get/cookie/session variables sharing the same name and that someone thought it would be a good idea to tell you (using a message that does not actually describe anything related to the problem) that you just created a variable with a null/empty/"" value and one of the other type of variables already exists using the same name. Basically, if you did not explicitly set the new variable to a value and register_globals would have set it (even if you have set register_globals off) the message is to warn you that register_globals won't set the variable for you (even if you have set register_globals off.)

 

If you don't want to disable the error messages, you will need to make sure that your program/post/get/session/cookie variables have unique names. All of this BS has been removed in php6.

 

The bug part of this is that the underlying register_globals code is still doing all of the cross checking when variables are set or referenced ($_REQUEST uses this.) Turning off register_globals just stops the actual last step of setting the same-named variables.

Archived

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

×
×
  • 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.