bookmark - OSCommerce Errors Passed variable is not an array or object

OSCommerce Errors - Passed variable is not an array or object

 
 Discussion by demolaynyc with 5 Replies.
 Last Update: June 2, 2008, 8:22 am
 
bookmark - OSCommerce Errors Passed variable is not an array or object  
    
free web hosting
 
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:

CODE

<?php
/*
$Id: object_info.php,v 1.6 2003/06/20 16:23:08 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
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.

Mon Jan 1, 2007    Reply    New Discussion   


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 :)

Mon Jan 1, 2007    Reply    New Discussion   

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.

Wed Jan 3, 2007    Reply    New Discussion   

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:

CODE

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

Mon Jan 8, 2007    Reply    New Discussion   


Thanks for the help. But we found out that it was because of the settings of the domain. The main domain's path had to be rerouted to the root folder.

Tue Jan 9, 2007    Reply    New Discussion   

Replying to demolaynyc
Hey! I have exactly the same problem... Can you please tell me more about this server setting and how to fix it up?
10x in advance!

-reply by Sergey

Mon Jun 2, 2008    Reply    New Discussion   

Quickly Post to OSCommerce Errors Passed variable is not an array or object w/o signup Share Info about OSCommerce Errors Passed variable is not an array or object using Facebook, Twitter etc. email your friend about OSCommerce Errors Passed variable is not an array or object Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

Ajax! The Best Web App. Programing Method Ajax its not a new code its a new method that is great.  Ajax! The Best Web App. Programing Method Ajax its not a new code its a new method tha... (14) (1) Can Search Engine Spiders See Dynamic Content?   Can Search Engine Spiders See Dynamic Content?