[FX.php List] Annoying PHP warning

Andrew Denman adenman at tmea.org
Mon Sep 8 10:39:37 MDT 2008


The reason they're asking about this is because register_globals creates
those variables for you, so if you're using the same variable name
inadvertently you could get unexpected results.  Using the same variable
name as a session variable IS NOT a problem unless you also have
register_globals on.  There is a special case though...

As for the original warning, if session.bug_compat_42 is on in php.ini it
seems you can use the simplified variables for session variables even if
register_globals is off.  If you also have session.bug_compat_warn on, you
will get the warning message whenever you access one of those variables.
According to the PHP docs, both of these default to true. If you don't want
to change php.ini, I would check to make sure you are not using any
variables named the same as session variables before you explicitly set
them, otherwise disabling the warning message and/or the bug should get rid
of the warnings.

Andrew Denman


-----Original Message-----
From: fx.php_list-bounces at mail.iviking.org
[mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of David Ness
Sent: Monday, September 08, 2008 11:04 AM
To: FX.php Discussion List
Subject: RE: [FX.php List] Annoying PHP warning


-----Original Message-----
On this page, I have 2 session variables that I read in and use for a  
URL:

$the_db = $_SESSION['the_db'];
$return_link = $_SESSION['return_link'];

Is this a bad thing to do? If so, I'm wondering why it hasn't been a  
problem in other pages...
---------------

I do this all the time, many dozens of times on some pages, with no
problems.

 
David Allen Ness
Database Systems Programmer
Web Applications Developer
 
_______________________________________________
FX.php_List mailing list
FX.php_List at mail.iviking.org
http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list