Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Call to member function or a non-object!!!


Guest

Recommended Posts

Hi,

 

I used the code posted by enigma (changed the history). Should I change it back and use the second solution instead? Is there anything that could happen if I do not rectify the changes?

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
Somehow seems the navigation parameter remains registered so the class is not instantiated. As a test try this:

 

1. Backup catalog\includes\application_top.php then open it locate this code:

// 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();

 

Replace it with this

// 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();

 

Many thanks!!!!

This can fix the issue.

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...
  • 3 weeks later...

My host upgraded to PHP 5.2.6 and all of the sudden I'm getting this error. I've tried all the recommended fixes and still it doesn't work. When I install the fix, and try to login, it doesn't redirect to the appropriate page. Any idea what might be causing this problem?

Link to comment
Share on other sites

i have replace the code, as under,

 

// 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();

 

 

 

Replace it with this

 

// 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();

 

it is working fine, now, but problem is i am using wishlist contribution, it erros me

Fatal error: Call to a member function restore_wishlist() on a non-object in /public_html/create_account.php 273 line

 

create_account.php

 

 

273: $wishList->restore_wishlist();

Link to comment
Share on other sites

My host upgraded to PHP 5.2.6 and all of the sudden I'm getting this error. I've tried all the recommended fixes and still it doesn't work. When I install the fix, and try to login, it doesn't redirect to the appropriate page. Any idea what might be causing this problem?

 

I found the problem that I was having and wanted to report it here for the benefit of others. The latest version of PHP installs a security feature called suhosin. This feature caused my OSC instance to stop working by throwing the error seen in this thread. I got it working by turning On the suhosin.simulation flag which essentially disables the security feature. Read about it here.

 

http://www.hardened-php.net/suhosin/config...osin.simulation

 

If you server permissions allow it you can probably add something like this to your .htaccess file:

 

php_value suhosin.simulation 1

Link to comment
Share on other sites

  • 2 months later...
Thank you, i had same problem and this code seems to fix it so far, i still have a lot to test. I also added code from duhy, seemes to be working just fine.

Thank you both!

 

Brilliant! works for me. I was banging my head off the wall for ages till I found this!

Seo Go

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Here is the final code that will correct Fatal error: Call to a member function on a non-object in... and will not recreate the navigtion each time you open a new page if the path is an object:

 

// navigation history

if (tep_session_is_registered('navigation')) {

if (is_object($navigation)) { } else {

$navigation = new navigationHistory; }

} else {

tep_session_register('navigation');

$navigation = new navigationHistory;

}

$navigation->add_current_page();

 

that should replace the old code:

// 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();

 

And here is the code that will correct Fatal error: Call to a member function count_wishlist() on a non-object in... for those who insalled Wishlist contribution:

 

// wishlist data

if (tep_session_is_registered('wishList')) {

if (is_object($wishList)) { } else {

$wishList = new wishlist; }

} else {

tep_session_register('wishList');

$wishList = new wishlist;

}

 

that should replace the old code:

// wishlist data

if(!tep_session_is_registered('wishList')) {

tep_session_register('wishList');

$wishList = new wishlist;

}

 

Andybird

Link to comment
Share on other sites

  • 1 month later...

Somehow seems the navigation parameter remains registered so the class is not instantiated. As a test try this:

 

1. Backup catalog\includes\application_top.php then open it locate this code:

// 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();

 

Replace it with this

// 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();

Oh God blessss you!!! geezzzzzzzzzzzzzzzzzz I'm going crazy with all of this, can't wait to finish editing all this stuff, so that I can get on with adding products, much easier stuff. thnk you thank you thank you!!! worked perfect!!!

I Hate PHP, LoLssss

Visit My Site, Any constructive comments and suggestions Welcome :)

WARNING: IT'S STILL UNDER CONSTRUCTION, LOLS

Link to comment
Share on other sites

Hm, I tried both solutions.

 

First try:

Add

} else {
         $navigation = new navigationHistory;

With this solution, the error disappeared, but the redirection from the Cart to the login-page to the checkout_shipping was broken !!

 

 

Then, my second try was described here in Posting #10 from Gunter:

Replace
if (tep_session_is_registered('navigation')) {
with
if (tep_session_is_registered('navigation') && is_object($navigation)) {

What about this solution??

With this one, the redirection is working and the error disappeared. Much better IMHO.

 

What do you think about the solution of Gunter ?

 

Thanks in advance,

Andreas

Link to comment
Share on other sites

  • 5 months later...

Somehow seems the navigation parameter remains registered so the class is not instantiated. As a test try this:

 

1. Backup catalog\includes\application_top.php then open it locate this code:

// 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();

 

Replace it with this

// 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();

 

It makes navigation->add_current_page() not work! so this is not a good solution!

Link to comment
Share on other sites

Just FYI. If you use the solution suggested in the posts before, you will loose the navigation history because the object is created again every time. Doing it like this is much better:

 

Replace

if (tep_session_is_registered('navigation')) {

with

if (tep_session_is_registered('navigation') && is_object($navigation)) {

 

 

For some reason on some systems, the session variable is registered on the first object but the object doesn't persist. On my local Windows install it starts persisting after the second call.

HTH

 

Gunter

 

if (tep_session_is_registered('navigation') && is_object($navigation)) {

Also lose the navigation history. not a perfect solution!

Link to comment
Share on other sites

  • 1 month later...

guys this is a problem with browser and nothing is wrong with ur system, just clear your browsing history and cache files and restart your browser and the problem will be gone. above solutions are not really required.

Link to comment
Share on other sites

  • 1 month later...

Just FYI. If you use the solution suggested in the posts before, you will loose the navigation history because the object is created again every time. Doing it like this is much better:

 

Replace

if (tep_session_is_registered('navigation')) {

with

if (tep_session_is_registered('navigation') && is_object($navigation)) {

 

 

For some reason on some systems, the session variable is registered on the first object but the object doesn't persist. On my local Windows install it starts persisting after the second call.

HTH

 

Gunter

 

 

Just wanted to say, thanks very much..and thankyou to anyone contributing problem solvers on this forum...couldn't believe after all that had been done it threw an error at me like this, thought I was doomed, but this solved the issue straight away!!!

I'm not and never have been literate with php, learning now though!, have to say I'm very glad I did the initial forum reading and research, I read someones advice somewhere to not install 'STS' stick with raw php and you'll get there, have to say so far that information has been priceless, thanks again Gunter.

Link to comment
Share on other sites

THANK YOU! This is great information! It worked for me.

Tedra

 

- - - - -

Just FYI. If you use the solution suggested in the posts before, you will loose the navigation history because the object is created again every time. Doing it like this is much better:

 

Replace

if (tep_session_is_registered('navigation')) {

with

if (tep_session_is_registered('navigation') && is_object($navigation)) {

 

 

For some reason on some systems, the session variable is registered on the first object but the object doesn't persist. On my local Windows install it starts persisting after the second call.

HTH

 

Gunter

Link to comment
Share on other sites

  • 3 weeks later...

Somehow seems the navigation parameter remains registered so the class is not instantiated. As a test try this:

 

1. Backup catalog\includes\application_top.php then open it locate this code:

// 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();

 

Replace it with this

// 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();

 

 

Thanks this work for me n.n

Link to comment
Share on other sites

  • 10 months later...

Thank you guntersammet for the fix - worked for me which then caused another error but I found the answer.

I was getting an error saying the the member function buildblocks() was a non-object.

 

Find the fix HERE - if it is the same one I was experiencing.

Link to comment
Share on other sites

  • 1 month later...
  • 7 months later...

I did the original fix on this thread and am getting another error.

 

Fatal error: Call to a member function restart_capture() on a non-object in /home/user/public_html/products/includes/header.php on line 14

 

edit: This is after installing Header Tags SEO 3.1.8.

 

Thanks

Link to comment
Share on other sites

I did the original fix on this thread and am getting another error.

 

Fatal error: Call to a member function restart_capture() on a non-object in /home/user/public_html/products/includes/header.php on line 14

 

edit: This is after installing Header Tags SEO 3.1.8.

 

Thanks

 

Hey there fellers! It's fixed. Forgot to add a line of code at the bottom of app top. Seems I'm so smart, I don't even have to think before I speak. Gotta mind like uh Swiss kernometer. Know what I mean Bubba? LOL

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...