Page 1 of 1

session.bug_compat_warn problem

Posted: Wed May 09, 2012 9:57 am
by old_celt
I've filtered all the code relating to this installation and the only piece of code that seems relevant is this:-

Code: Select all

  function tep_session_close() {
    foreach($_SESSION as $key => $value) {
      global $$key;
      $_SESSION[$key] = $$key;
    }
  } 
I tried changing the name of the global variable $$key but it had no effect. I'm a bit stuck as to where else to look in the code. This is not my code, by the way, but part of osCommerce.

I cannot alter php.ini on my server and placing 'session.bug_compat_warn off' in .htaccess (or anywhere else suggested in many web pages) has no effect.

Would appreciate any help on this.
Ken

Re: session.bug_compat_warn problem

Posted: Wed May 09, 2012 10:00 am
by x_mutatis_mutandis_x
Change your "$key" variable in foreach to some other variable (like "$k"). Something like:

Code: Select all

function tep_session_close() {
     foreach($_SESSION as $k => $value) {
       global $key;
       $_SESSION[$k] = $key;
     }   

Re: session.bug_compat_warn problem

Posted: Thu May 10, 2012 4:58 am
by old_celt
:( Hasn't solved it I'm afraid!

Re: session.bug_compat_warn problem

Posted: Thu May 10, 2012 9:42 am
by x_mutatis_mutandis_x
Include these lines at the beginning of your script:

Code: Select all

ini_set('session.bug_compat_42',0);
ini_set('session.bug_compat_warn',0);

Re: session.bug_compat_warn problem

Posted: Thu May 10, 2012 9:48 am
by old_celt
This application holds around 250 scripts. Are you suggesting that those two lines need to be inserted in every one of them?
Ken

Re: session.bug_compat_warn problem

Posted: Thu May 10, 2012 9:53 am
by x_mutatis_mutandis_x
If you can identify how the scripts are getting called, you can narrow it down to a few. There's an alternate solution. Do you have access to your apache's configuration? (httpd.conf)

Re: session.bug_compat_warn problem

Posted: Fri May 11, 2012 5:03 am
by old_celt
Unfortunately, on the live server no changes are allowed to php.ini or the apache ini files. I can play around on my local setup but that doesn't help when I can't do the same thing live.

I've decided to bite the bullet and go through all the code changing $HTTP_xxxx_VARS to the preferred forms suitable for php versions 4.1.0 or above - my server is on 5.2.9-2.

I'll let you know how I get on - many thanks for your interest and helpful suggestions.
Ken