session.bug_compat_warn problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
old_celt
Forum Newbie
Posts: 4
Joined: Wed May 09, 2012 9:40 am

session.bug_compat_warn problem

Post 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
x_mutatis_mutandis_x
Forum Contributor
Posts: 160
Joined: Tue Apr 17, 2012 12:57 pm

Re: session.bug_compat_warn problem

Post 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;
     }   
old_celt
Forum Newbie
Posts: 4
Joined: Wed May 09, 2012 9:40 am

Re: session.bug_compat_warn problem

Post by old_celt »

:( Hasn't solved it I'm afraid!
x_mutatis_mutandis_x
Forum Contributor
Posts: 160
Joined: Tue Apr 17, 2012 12:57 pm

Re: session.bug_compat_warn problem

Post 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);
old_celt
Forum Newbie
Posts: 4
Joined: Wed May 09, 2012 9:40 am

Re: session.bug_compat_warn problem

Post 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
x_mutatis_mutandis_x
Forum Contributor
Posts: 160
Joined: Tue Apr 17, 2012 12:57 pm

Re: session.bug_compat_warn problem

Post 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)
old_celt
Forum Newbie
Posts: 4
Joined: Wed May 09, 2012 9:40 am

Re: session.bug_compat_warn problem

Post 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
Post Reply