X-Cart Orders Missing because of array_merge() errors

I recently updated my hosting server and broke a client’s site. The client called and said all of their x-cart orders were missing. They were trying to look up old orders and the search was revealing zero results.

The X-cart store version is 3.4.8 Gold running on php 5.2.12. The error was revealed in the error_log for the website as shown below:

[Mon Feb 01 11:16:56 2010] [error] [client xx.xx.xx.xx] PHP Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /var/www/vhosts/domain.com/httpdocs/store/include/or ders.php on line 91, referer: http://www.domain.com/store/admin/orders.php?mode=&orderid1=&orderid2=&substring=&provider=&status=&delimiter=%3B&StartMonth=02&StartDay=1&StartYear=2003&EndMonth=02&EndDay=1&EndYear=2010


To fix, you need to update the array to fix a php 5.x change.

Change Line 91 in /includes/order.php from

$orders = array_merge($orders, func_query(“select $sql_tbl[orders].*, $sql_tbl[giftcerts].gcid, $sql_tbl[giftcerts].purchaser, $sql_tbl[giftcerts].recipient, $sql_tbl[giftcerts].message, $sql_tbl[giftcerts]

to this:

$orders = array_merge($orders, (array)func_query(“select $sql_tbl[orders].*, $sql_tbl[giftcerts].gcid, $sql_tbl[giftcerts].purchaser, $sql_tbl[giftcerts].recipient, $sql_tbl[giftcerts].message, $sql_tbl[giftcerts]

Notice the (array) in front of func_query.