Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Fatal Error: Cannot re-assign $this in upload.php on line 31


rockstar

Recommended Posts

Posted

I'm trying to install a new version of oscommerce-2.2ms2 Win on my local Windows machine. I'm running PHP 5.x MySQL 5.0.

 

I followed the installation instructions and got to the end with no problems. I can view the store on my local machine, but when I try to view the admin site I get the following error message:

 

Fatal error: Cannot re-assign $this in C:\Documents and Settings\Charles\My Documents\My Website\OSCommerce\catalog\admin\includes\classes\upload.php on line 31

 

Help?

Posted

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

  • 1 month later...
  • 10 months later...
Posted

I have just been asked to helpa friend find out what is wrong with their shopping cart and they are also getting

Fatal error: Cannot re-assign $this in /home/canvas/public_html/shop/admin/includes/classes/upload.php on line 31 when you click on "Add to Cart"

 

I downloaded the upload.php file and commented out the $this = null; and then added unset($this); and now I get the same error on line 33.

 

I then deleted the unset($this); and still get the same error on line 33.

 

Her install is osCommerce 2.2-MS2 and I do not know if it has ever been updated, but it is doubtful that it has.

 

I do not know if her host just upgraded the hosting from php4 to php5 for it to just stop working.

 

I also see in her Fantastico there is an upgrade available of osCommerce Online Merchant v2.2 Release Candidate 2a but I am no osCommerce expert and would not feel comfortable trying to upgrade her software should the upgrade not work (I could not ever fix it myself).

 

So, anyone have any idea why deleting the $this = null did not fix her problem?

 

http://canvasone.com/shop/product_info.php?products_id=28 and then click on Add to Cart at the bottom.

 

TIA,

 

Judy

Posted

If you still get the error you probably haven't modified the code correctly...

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
If you still get the error you probably haven't modified the code correctly...

:huh:

Well, this is the section now:

if ( ($this->parse() == true) && ($this->save() == true) ) {

return true;

} else {

return false;

}

 

so unless there is a hidden space or something in there it would appear that is should work. I am thinking that the error is not as it appears but it showing this fatal error but it it something else.

Posted
Well, this is the section now:

if ( ($this->parse() == true) && ($this->save() == true) ) {

return true;

} else {

return false;

}

 

so unless there is a hidden space or something in there it would appear that is should work. I am thinking that the error is not as it appears but it showing this fatal error but it it something else.

 

Okay... I fixed it. It was throwing me a loop because I didn't notice the error had changed to be the 33rd line in the includes/classes/upload.php instead of the admin/includes/classes/upload.php (which I had already fixed like above).

 

All looks to be good to go!

Archived

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

×
×
  • Create New...