Upgraded to Drupal 6.22 and the new ubercart dev from 2011 Jul 07. Now I get "warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /usr/www/users/thissu/includes/database.mysql.inc on line 329." on the checkout review page. The data from the checkout form are not being loaded.

Comments

Medom’s picture

Also got this when upgrading ubercart: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL' at line 1 query: ALTER TABLE uc_shipments ALTER changed SET NOT NULL i /usr/www/users/thissu/update.php på linje 77."

tr’s picture

Error in #1 comes from a bad update function and was introduced in #1204338: Request for new "changed" field in "uc_shipments" table for automated tracking purposes. There's a fix in that issue.

Medom’s picture

Still no luck. Even loaded a backup, and installed the new dev version update (2011 jul 11) on top. Same error.

Then I followed the patch update guide. The patch had been applyed in the new dev, but the database changes still pointed at 6006. I changed it to 6005, deleted the 'changed' column and ran update.php. Still the same.

tr’s picture

The patch only solves the problem in #1, not the mysql_real_escape_string() problem.

Medom’s picture

Oh, I see what you mean. Then I have a huge problem with the main error. Am I the only one?

tr’s picture

Priority: Critical » Normal

Yes, as far as I know you're the only one. It's going to be impossible to track this down without more information. It's not even clear to me that it's an Ubercart problem; since the error is from Drupal core it could be caused by any module you have installed. A quick search of drupal.org shows a number of issues like this: http://drupal.org/node/766256

If you could put some print statements into db_escape_string() like suggested in that thread, that would help narrow down the problem. In particular, we need to know what are the contents of the array variable that's supposed to be a string according to the error message, and we need to see a backtrace that shows where in Ubercart (if it's Ubercart) this function is being invoked.

Medom’s picture

To be more precise, I think it is the customer data from the checkout form, which is causing the error. Going to the checkout/review page that information is missing, and the error is showing. I now tried the “print out trick” you referred to. The result is “Array ( [818c8a1b37] => 1 )”, not making much sense to me.

I am very happy, you are trying to help me.

kenwen’s picture

I'm getting the same problem here as well - wondered why i wasn't getting any sales for a whole week!

mysqli_real_escape_string() expects parameter 2 to be string, array given in database.mysqli.inc on line 329.

Data from the checkout form doesn't appear to get passed to the review page as the user details are blank in review form

Also noticed that it appears to bypass PayPal completely (my payment processor) - you get to the order review page, no data, then when you hit submit, instead of diverting to PayPal, it completes order, which is left pending

kenwen’s picture

Just did some deductive work...

and it appears that there was a problem with the mailchimp integration module. I disabled it and everything appears to work

Will be posting to the ubercart mailchimp issue queue

Medom’s picture

Spot on! The mailchimp module for Ubercart created the error. Thanks for the help kenwen, i'll be looking for an update to the module.

tr’s picture

Status: Active » Fixed

Sounds like this can be closed then.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dsobon’s picture

Fix for "mysqli_real_escape_string() expects parameter 2 to be string, array given in db_escape_string()":

--- uc_mailchimp.module.orig 2009-12-17 01:00:00.000000000 +1100
+++ uc_mailchimp.module 2011-08-17 13:58:03.000000000 +1000
@@ -118,7 +118,7 @@
         return $review;
     break;
     case 'process':
-        $arg1->uc_mailchimp = $arg2;
+        $arg1->uc_mailchimp = serialize($arg2);
      
     break;
     case 'settings':
binarylime’s picture

Status: Closed (fixed) » Active

Problem persists for me. I've tried disabling Mailchimp all together but still having the issue.

warning: mysql_real_escape_string() expects parameter 1 to be string, array given domain.com/html/includes/database.mysql.inc on line 329. displayed on 'review' page of checkout.

'Paying by' field is blank on review screen even though paypal was selected on previous page. Clicking on submit order completes the order but does not redirect to paypal to take payment.

Mailchimp was working fine with ubercart up until now. I've recently installed Ubercart Marketplace and more specifically a this patch: http://drupal.org/node/763220#comment-4900560.

I believe that my problem has occurred since this patch but cannot be certain.

Please help. Thank you.

longwave’s picture

Status: Active » Closed (fixed)

The error is so generic that we cannot help you further without more information - you should try reverting that patch and see if it still occurs. And if you find this only occurs with Ubercart Marketplace, then you should raise this issue in the Ubercart Marketplace queue.

ryank76’s picture

Patch in #13 worked for me - thanks

vood002’s picture

Had a bug after an update of Ubercart that was causing orders to not save properly after cart/checkout (resulting in address fields showing UNKNOWN), and this turned out to be the culprit.

Patch in #13 worked for me as well.