Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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 dat

Posted on 2010-11-16
3
Medium Priority
?
479 Views
Last Modified: 2012-06-27
Hi,

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

Above is the warning I receive on some on my pages, a common topic on ee, is this regarding the code below? If not how do I find the line it refers to as the warning states line ‘0’

<?php
session_start();

if (!$_SESSION["valid_user"])
{
// User not logged in, redirect to login page
Header("Location: login.php");
}

Open in new window

0
Comment
Question by:AlexAmbler
  • 2
3 Comments
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 34151983
It's a configuration variable.  Assume you are at PHP 5+, right?  Ask your hosting company to turn this old thing off.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 1000 total points
ID: 34151987
However that said, this is not a good form of code:

if (!$_SESSION["valid_user"])

Maybe you wan to be more at this:

if (!isset($_SESSION["valid_user"]))

The values for FALSE are loosely typed in PHP.  If you tighten up your code, you will almost certainly get better outcomes.
0
 

Author Closing Comment

by:AlexAmbler
ID: 34209855
thank you.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question