FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Changing session variables gives warning
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Changing session variables gives warning [message #178960] Tue, 28 August 2012 06:37 Go to previous message
jwcarlton is currently offline  jwcarlton
Messages: 76
Registered: December 2010
Karma:
Member
I'm setting a series of SESSION variables, then on each page check to make sure one of those variables hasn't changed; if so, the script reloads them. The purpose is to limit the number of MySQL queries on an already taxed server.

I'm using a script like this:

if ($default != $_SESSION['default']) {
$var_query = sprintf("SELECT * FROM vars WHERE var='%s' LIMIT 1",
mysql_real_escape_string($default));

list($_SESSION['default'], ...) = mysql_fetch_row(mysql_query($var_query));
session_commit();
}

But now I get this warning in the log:

PHP Warning: session_commit() [<a href='function.session-commit'>function.session-commit</a>]: 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 whatever.php on line 165

I'm using PHP 5.2.17.

Should I be changing these variables in a different way? Or is it perfectly safe to change the script to:

session_commit();
ini_set('session.bug_compat_warn', 0);
ini_set('session.bug_compat_42', 0);
[Message index]
 
Read Message
Read Message
Previous Topic: Re: XMLHttpRequest: POST with Data
Next Topic: Database Abstraction Layer
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 08:33:41 GMT 2024

Total time taken to generate the page: 0.04239 seconds