Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal error: Call to a member function on a non-object in


Guest

Recommended Posts

Posted

Hmm i get this for the application_top.php for the cataloge

 

 

The offending lines are

// navigation history

 if (tep_session_is_registered('navigation')) {

   if (PHP_VERSION < 4) {

     $broken_navigation = $navigation;

     $navigation = new navigationHistory;

     $navigation->unserialize($broken_navigation);

   }

 } else {

   tep_session_register('navigation');

   $navigation = new navigationHistory;

 }

 $navigation->add_current_page();

 

Anyone got any ideas?

  • 1 year later...
Posted

After wresting briefly with this problem, I found the solution. The problem is that in some configurations (at least mine), the navigation history section in "application_top.php" doesn't catch the possibility that the session "navigation" variable is registered and the PHP version running is 4 or above. I'm really not quite sure what caused this huge oversight on the part of the developers (with all due respect).

 

Change the nagivation history chunk of code to read:

 

// navigation history
 if (tep_session_is_registered('navigation')) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   } else {
	 $navigation = new navigationHistory;
 }
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

 

and it should work just fine.

  • 4 years later...
Posted

I don't know, but I was using PHP 5, and because a payment module I had to imigrate to an ASP server (php compatibility installed).

 

After this change, the error apearred..

 

Thank you for the code correction!

It is all right now!!!

  • 2 weeks later...
Posted

DragonEyeDesign's code is incorrect and will cause a new problem of your navigation history continually getting erased. This is the correct fix:

 

// navigation history
if (tep_session_is_registered('navigation')) {
  if (PHP_VERSION < 4) {
 $broken_navigation = $navigation;
 $navigation = new navigationHistory;
 $navigation->unserialize($broken_navigation);
  } elseif (!is_object($navigation)) {
 $navigation = new navigationHistory;
  }
} else {
  tep_session_register('navigation');
  $navigation = new navigationHistory;
}
$navigation->add_current_page();

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

  • 1 month later...
Posted

wow,

 

That is a wonderful fix, I was scratching my head after I just installed a contribution which caused this error.

 

Thanks once again for the fix.

  • 1 month later...
Posted
DragonEyeDesign's code is incorrect and will cause a new problem of your navigation history continually getting erased. This is the correct fix:

 

// navigation history
if (tep_session_is_registered('navigation')) {
  if (PHP_VERSION < 4) {
 $broken_navigation = $navigation;
 $navigation = new navigationHistory;
 $navigation->unserialize($broken_navigation);
  } elseif (!is_object($navigation)) {
 $navigation = new navigationHistory;
  }
} else {
  tep_session_register('navigation');
  $navigation = new navigationHistory;
}
$navigation->add_current_page();

 

yes, this code is right!!

Many Thanks!

 

Best Regards,

  • 1 year later...
Posted

DragonEyeDesign's code is incorrect and will cause a new problem of your navigation history continually getting erased. This is the correct fix:

 

// navigation history
if (tep_session_is_registered('navigation')) {
  if (PHP_VERSION < 4) {
 $broken_navigation = $navigation;
 $navigation = new navigationHistory;
 $navigation->unserialize($broken_navigation);
  } elseif (!is_object($navigation)) {
 $navigation = new navigationHistory;
  }
} else {
  tep_session_register('navigation');
  $navigation = new navigationHistory;
}
$navigation->add_current_page();

I strongly recommend this code! :rolleyes: it solved the problem perfectly. that is, the navigation history is still there.

I've tried other code. they looks like solved the problem, but actually the navigation history has lost!

Posted

This bug, which will evidently never be fixed, has been discussed many times:

http://www.oscommerce.com/forums/index.php?showtopic=346007

http://www.oscommerce.com/forums/index.php?showtopic=168369

http://www.oscommerce.com/forums/topic/168369-call-to-member-function-or-a-non-object/page__st__20

 

Did you look at all of these? The fix I've seen recommended most often (although there's no official word whether it's the right one) is

// navigation history
 if (tep_session_is_registered('navigation') && is_object($navigation)) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   } else {
     $navigation = new navigationHistory;
   }
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

Archived

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

×
×
  • Create New...