Re: Warning regarding session side-effect : puzzle



FutureShock wrote:
trookat wrote:
I have been working with php on and off for a while and I have just come across a warning that i haven't seen before

I am using php5 . the warning in question is
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

i'm just mucking about with some new login stuff using sessions and it all works just fine i decided to update the password in my sqlite db using



$pass=md5('dude');
$system->sqldb->queryExec("UPDATE users SET username='trookat', user_password='$pass' WHERE username='admin'");

i noticed the warning at the end of html .

i commented the sql line out and still got the warning

I renamed the $pass to $passs and the warning vanished ,

note Globals is turned off . Not once i have used $pass in the other code ,

the only reference i have to a pass is in a session var ( thats going to be renamed anyway)


I am assuming that because i have a session with a 'pass' var ( which is always checked with $_SESSION['pass'] ) and i used $pass as a var its caused this error

what i want to know is why the warning? i am assigning a value to $pass, its not like am trying to do a conditional check on it.

Anyone have answers the why? how do i make sure these warnings don't come up on servers that don't have setting session.bug_compat_42 or session.bug_compat_warn set to off. ( other then errorlevel setting? )


Thanks for you time
- trookat

If you can supply a little more code it may be more helpful, but just off the bat, did you use session_start() at the beginning of the pages where your accessing $_SESSION?

Scotty

I have a session_start() top end of index.php then i go and include a general file with a class called core that handles a usersystem object , content system object , etc and all this works fine

I have sort of nutted it out.

After much playing with code it appears that if you assign/check a variable in the global scope that matches one in a $_SESSION while session_start() is in effect it causes this warning.
so if somewhere in your code you have assined a session value
eg
$_SESSION['pass']=md5('your mamma');

and you decide to use a $pass var that is not in a function or a object ( its a global var) it will bring this error up . EVEN if you are not assigning $pass = $_SESSION['pass'];

its weirdness all around. something i would never have seen if i didn't comment out error_reporting(0);

thanks anyway :P
.



Relevant Pages

  • Re: Warning regarding session side-effect : puzzle
    ... come across a warning that i haven't seen before ... Please be advised that the session extension does not consider global variables as a source of data, ... note Globals is turned off. ... I am assuming that because i have a session with a 'pass' var and i used $pass as a var its caused this error ...
    (alt.php)
  • Problem with session_start
    ... I get a warning and cannot start a session. ... the php script before any HTML tags or output to the browser. ... Cannot send session cache limiter - headers already sent (output ...
    (comp.lang.php)
  • Re: Vesoft Logoff question
    ... to be counted against the session. ... I put the warning message and time into the logoff.data file. ... * To join/leave the list, search archives, change list settings, * ...
    (comp.sys.hp.mpe)
  • SESSION error -> Your script possibly relies on a session side-effect which existed until PH
    ... 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, ...
    (comp.lang.php)
  • "register_globals off" and "session side-effect"
    ... Warning: Unknown(): Your script possibly relies on a session side- ... I should replace all global variables which I care ...
    (comp.lang.php)