Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error that dissapear refreshing the page


rgplanet

Recommended Posts

Posted

Hi,

 

I continue step by step with the Oscommerce site. Now, I have a strange problem. When I go to the page with the clean cache, it says:

 

Warning: Invalid argument supplied for foreach() in /home8/sendapac/public_html/catalog/includes/functions/sessions.php

 

The code in sessions.php in these lines (109-115) is:

 

// Register Globals MOD - http://www.magic-seo-url.com

function tep_session_close() {

foreach($_SESSION as $key => $value) {

global $$key;

$_SESSION[$key] = $$key;

}

}

 

The problem is that in Safari (mac) it doesnt appear and in windows, the first time appear and, when you refresh, it dissapear. You can see it in http://www.sendapackage.com

 

Thanks in advance,

 

Roger.

Posted

Hi, it appears that you are trying to access the session variable before it is created which would explain why the second time you load the page the error does not display.

 

I have NO knowlege of yuor setup or the contribution you are using but a workaround would be to check if the $_SESSION variable exists before you try to access it like this:

 

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

This should stop the error but you need to get to the route of it to make sure there isn't a problem else where. A start might be to find where the function is getting called from in this case.

Joe

 

MacMan strikes again!

 

Always backup first before listening to me!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...