Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Variable passed to each() is not an array or object object_info.php


lynnwenger

Recommended Posts

I've recently migrated OSCommerce to another server and now I've got a problem on SOME existing customers.

 

Customer View:

1. Customers can't enter their payment info and receive the following error

"An error occurred while trying to report this transaction to the

merchant. An e-mail has been sent to the merchant informing them of

the error. The following is the result of the attempt to charge your

credit card.

 

This transaction has been approved.

 

It is advisable for you to contact the merchant to verify that you will

receive the product or service."

 

2. They also aren't receiving their email confirmations.

 

Admin View:

1. Customers > Edit Customer error

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /services4/webpages/m/y/mychefdelivers.com/public/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /services4/webpages/m/y/mychefdelivers.com/public/admin/includes/classes/object_info.php on line 18

 

 

2. Customers > Orders

Before the migration, customer's details displayed on the order forms. On new orders, the customer's info doesn't show up.

 

 

Code View:

 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);
     }
   }
 }

Link to comment
Share on other sites

I've recently migrated OSCommerce to another server and now I've got a problem on SOME existing customers.

Admin View:

1. Customers > Edit Customer error

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /services4/webpages/m/y/mychefdelivers.com/public/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /services4/webpages/m/y/mychefdelivers.com/public/admin/includes/classes/object_info.php on line 18

 

 

 

I am also having the same problem, can anyone help?

Link to comment
Share on other sites

  • 3 weeks later...

Not sure, but it might have something to do with this. If the version of the new server is php 5.

-------

OsCommerce Errors After PHP5 Upgrade

 

After upgrading a OsCommerce site to PHP5 the follow errors occurred when using the customer part of the admin section:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /catalog/admin/customers.php on line 782

 

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /catalog/admin/customers.php on line 784

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /catalog/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /catalog/admin/includes/classes/object_info.php on line 18

 

 

To eliminate thee array_merge() errors, edit the admin/customers.php file:

 

Find these lines:

$customer_info = array_merge($country, $info, $reviews);

$cInfo_array = array_merge($customers, $customer_info); 

 

 

and change them to:

$customer_info = array_merge((array)$country, (array)$info, (array)$reviews);

$cInfo_array = array_merge((array)$customers, (array)$customer_info);

 

 

 

The last two errors were experienced when editing bogus customer entries which did not have all the required information (First Name, Last Name, etc.). We just purged these from the MySQL database via phpMyAdmin.

 

All thanks goes to http://fstcs.net/blogs/ryansuzuki/archive/...p5-upgrade.aspx

Link to comment
Share on other sites

  • 6 months later...
Not sure, but it might have something to do with this. If the version of the new server is php 5.

-------

To eliminate thee array_merge() errors, edit the admin/customers.php file:

 

Find these lines:

$customer_info = array_merge($country, $info, $reviews);

$cInfo_array = array_merge($customers, $customer_info); 

 

 

and change them to:

$customer_info = array_merge((array)$country, (array)$info, (array)$reviews);

$cInfo_array = array_merge((array)$customers, (array)$customer_info);

 

I followed these directions, but I'm still getting this error:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/mcgonza/public_html/store/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /home/mcgonza/public_html/store/admin/includes/classes/object_info.php on line 18

 

 

I checked my SQL and there are no entries that are causing this problem. Here is the code from object_info.php:

 

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

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 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);
     }
   }
 }
?>

Link to comment
Share on other sites

I followed these directions, but I'm still getting this error:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/mcgonza/public_html/store/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /home/mcgonza/public_html/store/admin/includes/classes/object_info.php on line 18

 

 

I checked my SQL and there are no entries that are causing this problem. Here is the code from object_info.php:

 

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

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 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);
     }
   }
 }
?>

 

 

I FIGURED IT OUT! I made the changes suggested. Then I decided to compare my files again to make sure I didn't miss any code and I DID. So I inserted the missing code and it works fine!

Link to comment
Share on other sites

  • 8 months later...
the follow errors occurred when using the customer part of the admin section:

 

After making a bunch changes to my db using phpAdmin I got the following errors when I went to admin > customers:

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /catalog/admin/customers.php on line 733

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /catalog/admin/customers.php on line 735

Warning: reset() [function.reset]: Passed variable is not an array or object in /catalog/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /catalog/admin/includes/classes/object_info.php on line 18

 

The below fix (mentioned above) in admin/customers.php near line #733 -735:

$customer_info = array_merge($country, $info, $reviews);

$cInfo_array = array_merge($customers, $customer_info); 

change to:

$customer_info = array_merge((array)$country, (array)$info, (array)$reviews);

$cInfo_array = array_merge((array)$customers, (array)$customer_info);

 

Was an instant fix when applied to the newest RC2a install - so thank you Andrae

 

Should this be included in the next osC release?

Link to comment
Share on other sites

  • 9 months later...
  • 8 months later...

PERFECT

:thumbsup:

 

Im having this same problem trying to access customers info in the Admin, the fix has removed the object_info error line 17 and 18 but its now just displaying some customers info as blank but yet others do work.

I had installed the Multi Store mod a while back and it seems like old customers details display fine but new customers since the 2010 upgrade are not accessible and show blank details instead.

Values in the DB look fine, everything seems to be in order so i dont know why this could be happening, any other ideas? havent found any other fixes for this on the oscommerce forum... :(

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...