Jump to content
xisto Community
Sign in to follow this  
demolaynyc

OSCommerce Errors Passed variable is not an array or object

Recommended Posts

I don't know where this topic is appropriate in so please move it if it's innapropriate for this place as this involves PHP and OSCommerce

Hi, I got an error stating the following:

Warning: reset(): Passed variable is not an array or object in /home/content/j/w/s/jws8118/html/catalog/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /home/content/j/w/s/jws8118/html/catalog/admin/includes/classes/object_info.php on line 18


Here's the source code:

<?php/*  $Id: object_info.php,v 1.6 2003/06/20 16:23:08 hpdl Exp $  osCommerce, Open Source E-Commerce Solutions  http://http://www.oscommerce.com/  Copyright (c) 2003 osCommerce  Released under the GNU General Public License*/  class objectInfo {// class constructor	function objectInfo($object_array) {	  reset($object_array);	  while (list($key, $value) = each($object_array)) {		$this->$key = tep_db_prepare_input($value);	  }	}  }?>


More problems are that my client can't add products to his cart. He also cannot upload any new products to the categories.

I'm asking the PHP programmers who have experience with OS Commerce and also those who know this to please help me with this problem. My client needs this problem fixed as soon as possible. I need solutions ASAP. Thank you.

Share this post


Link to post
Share on other sites

Hmm i dont use OScommerce ...I use Vurtua mart ...i found it much better and much better to hack it for your needs and a lot of support on thier forums..Have you tried the Os forums?Maybe try to backup the mysql db then remove Os commerce then reinstall with default values then replace the old db back in? that may work :)

Share this post


Link to post
Share on other sites

I have done a number of OSC sites myself, but my programming knowledge is weak.Have you posted this on the OSC forum, or done a search for the error message on that forum.Just as a side note ... I have started using Zen Cart for my E-Commerce projects. It is based on OSC, but to compare, it's like OSC on steroids.

Share this post


Link to post
Share on other sites

This may not be the right way to go about it as I don't know what information is being passed to this class, but you could do:

class objectInfo {	function objectInfo($object_array) {		$object_array = is_array($object_array) ? $object_array : array($object_array);		reset($object_array);		while(list($key, $value) = each($object_array)) {			$this->$key = tep_db_prepare_input($value);		}	}}

That will just insure that $object_array is an array, so that these methods that expect arrays can still continue without any warnings, however, they're just warnings and can usually be ignored, you just have to make sure that your error_reporting doesn't display them.

Cheers,

MC

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.