How to remove “setting session.bug_compat_42 or session.bug_compat_warn” Warning

Tags:

I was adding some features in one of my older website for a client and saw this warning:

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.

You can simply resolve this and make this warning disappear by avoiding using the same names for session variables and normal ones.

In my case, I just had to change the following code to:

$_SESSION['type'] = $type;

To this one:

$_SESSION['category_type'] =  $type;

That’s it!

Cheers.

Related posts:

  1. Get Session Name & Session ID in osCommerce Store
  2. Fix W3 Total Cache WordPress Plugin Error ‘Warning: Cannot modify header information – headers already sent’
  3. How to remove New Line characters for .csv export using php