I am encountering callback errors after setting up Google Checkout.
After following the instructions here; cert was purchased from GoDaddy. I get the following errors.
Google Checkout Integration Console (Sandbox) shows:
We encountered an error trying to access your server at https://shop.mydomain.com/google_checkout -- the error we got is Send failed with code: 500.
Local stack trace:
PHP Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in /var/www/html/modules/ubercart/uc_store/includes/uc_price.inc:129
Stack trace:
#0 /var/www/html/modules/ubercart/uc_store/includes/uc_price.inc(129): serialize(Array)
#1 /var/www/html/modules/ubercart/uc_order/uc_order.module(1436): uc_price(Array, Array)
#2 /var/www/html/modules/ubercart/uc_order/uc_order.module(1042): uc_order_get_total(Object(stdClass))
#3 /var/www/html/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.module(809): uc_order_save(Object(stdClass))
#4 /var/www/html/modules/ubercart/payment/uc_google_checkout/uc_google_checkout.pages.inc(36): uc_google_checkout_new_order(Object(SimpleXMLElement))
#5 [internal function]: uc_google_checkout_callback()
#6 /var/www/html/includes/menu.inc(348): call_user_func_array('uc_google_check...', Array)
#7 /var/www/html/index.php(18): menu_execute_active_handler()
#8 {main}
Comments
Comment #1
hsp.org commentedComment #2
hsp.org commentedThe thought occurred to me that I had customized some of the code in uc_google_checkout to extend some of the sales tax features. I've since reinstalled the base ubercart module and tested Google Checkout integration again. The error still displays when Google Checkout tries to callback to /google_checkout.
Any thoughts?
Comment #3
hsp.org commentedI've also downloaded the latest dev build shown below and can replicate the error above.
6.x-2.x-dev Download (878.8 KB) 2010-Mar-27Comment #4
hsp.org commentedStarted to monkey around with the code in order to get a callback from Google Checkout. Note that I'm still uncertain as to how this impacts the rest of ubercart, but I was at least able to receive callbacks from Google after implementing the following changes.
The first problem comes from line 129 in modules/ubercart/uc_store/includes/uc_price.inc
$key = md5(serialize($price_info + $context_clone + $options));It appears that this $key is never unpacked, so to work through the problem, I instead used json_encode to see if I'd encounter the same problems.
$key = md5(json_encode($price_info + $context_clone + $options));After setting this new config, the script fails again at another point where serialize() is called.
Line 394 modules/token/token.module
return crc32(serialize($object));The comment above the function states
So I decided to change this as well.
return crc32(json_encode($object));Sure enough the callback works now. I'm very uncomfortable actually using this, so I'd love to here from someone else...
Comment #5
hsp.org commentedDowngraded to official CentOS 5.4 approved version of PHP, and the problem has disappeared.
Comment #6
tr commentedTagging. PHP 5.3 breaks many things.
Comment #7
jm.federico commentedQuestion for all
I was having a similar problem with eway gatweay and I found that in uc_payment.module changing
to
gets rid of the problem and goes ahead and finishes the transaction and apparently things are working, any ideas if this will break thing later on?
Federico
Comment #8
jm.federico commentedMarking #834248: PHP Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' as a duplicate
Comment #9
Anonymous (not verified) commentedSame issue here on Ubercart 6.x-2.3 and upgrading to 6.x-2.4 does not fix the problem. I tried federico's solution above and this fixed it, although I don't understand it which is a bit of a concern.
Comment #10
jimrockford commentedI had same issue with google checkout as rfrohlich. rfrolich's code adjustments fixed it for me. Thanks! PHP 5.3.3 on CentOS release 5.5 (Final). Maybe when I have the time/desire maybe I'll downgrade my php since it was only goog checkout callback that this exception was occurring.
Comment #11
tr commentedRestoring tag.
Comment #12
drasgardian commentedjm.federico's solution fixed this for me. Using uc_eway rather than google checkout.
Comment #13
dave_______1 commentedHi rfrohlich,
Did you ever find any problems with changing serialize to json_encode in uc_price.inc?
I'm having problems with uc_google_checkout and my PHP 5.3 server and would like to know if that might work before I change anything.
Thanks.
Dave.
Comment #14
Island Usurper commentedI think this has something to do with the goofy string handling of SimpleXML. If this gets in, I ought to reroll #579786: uc_google_checkout: Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' to include these changes. It already has a few, but I didn't test it with PHP 5.3.
I'm a little leery about changing serialize() to json_encode(), especially having to rely on a change to another module, especially Token. Hopefully this change means we don't have to.
Comment #15
longwave@Island Usurper: the fact that this raises its head in uc_price() says to me that the idea of removing price caching altogether that I suggested in #948324: Price logic can hurt performance was even more of a good idea; serializing an entire order object just to build a cache key really doesn't sound sensible.
Comment #16
Island Usurper commentedI would not be opposed to that at all.
Comment #17
Island Usurper commentedNot extracting the XML data as strings is bound to cause problems somewhere, especially since PHP doesn't always make it clear when it's going to do its magic type juggling anyway.
If this problem continues, please reopen this issue.
Comment #19
fbau commentedI have experienced the same problem suddenly this week.
Have used the eway credit card payment method previously for over 18 months.
Currently using Drupal 6.22 and PHP 5.3.8. Have duplicated the error with credit card checkout using uc-eway with both Ubercart versions ubercart-6.x-2.4 and ubercart-6.x-2.6. (rolled back to ubercart-6.x-2.4 to test after encountering the error with ubercart-6.x-2.6
Have confirmed #7 jm.federico eliminates the error with both ubercart versions.
Fatal error output displayed to users on eway submit with the line
if (is_array($data)) {
$data = serialize($data);
};
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in /home/site/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module:610 Stack trace: #0 /home/site/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module(610): serialize(Array) #1 /home/site/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module(576): uc_payment_enter('668', 'credit', 48.999995, '1', Array, 'Credit card pay...') #2 /home/site/public_html/sites/all/modules/ubercart/payment/uc_credit/uc_credit.module(316): uc_payment_process('credit', '668', 48.999995, Array, true, NULL, false) #3 /home/site/public_html/sites/all/modules/ubercart/uc_cart/uc_cart.pages.inc(502): uc_credit_order('submit', Object(stdClass), NULL) #4 /home/site/public_html/includes/form.inc(781): uc_cart_checkout_review_form_submit(Array, Array) #5 /home/site/public_html/includes/form.inc(421): form_execute_handlers('submit', Array, Array) #6 /home/si in /home/site/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module on line 610
if (is_array($data)) {
$data = json_encode($data);
}
from #7 allows the user to submit in eway test mode without the fatal error
Comment #20
Island Usurper commentedBut what about the dev version? That's where the fix was put in place.
Comment #21
fbau commentedThank you
confirming the credit card/eway fatal error issue does not occur using ubercart 6.x-2.x-dev Last updated: September 27, 2011 - 00:46
Comment #22
fbau commentedActually I was wrong in post #21
The eway gateway worked in test mode but was not actually working when live.
site was continually getting double payments from customers trying to resubmit after fatal error.
Tried ubercart dev up to release 2011-Oct-06
Tested live with own credit card and on submit get following error;
Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in /home/account-name/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module:630 Stack trace: #0 /home/account-name/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module(630): serialize(Array) #1 /home/account-name/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module(581): uc_payment_enter('695', 'credit', 3.674, '1', Array, 'Credit card pay...') #2 /home/account-name/public_html/sites/all/modules/ubercart/payment/uc_credit/uc_credit.module(316): uc_payment_process('credit', '695', 3.674, Array, true, NULL, false) #3 /home/account-name/public_html/sites/all/modules/ubercart/uc_cart/uc_cart.pages.inc(502): uc_credit_order('submit', Object(stdClass), NULL) #4 /home/account-name/public_html/includes/form.inc(781): uc_cart_checkout_review_form_submit(Array, Array) #5 /home/account-name/public_html/includes/form.inc(421): form_execute_handlers('submit', Array, Array) #6 /home/account-name/publ in /home/account-name/public_html/sites/all/modules/ubercart/payment/uc_payment/uc_payment.module on line 630
using fix from #7 allows eway gateway transaction to complete without fatal error and display confirmation to customer avoiding repeat submissions (using ubercart 6.x-2.x-dev (2011-Oct-06) up to release 2011-Oct-06)
Comment #23
Anonymous (not verified) commentedI forgot about this issue and upgraded to 6.x.2.6, and my client's site crapped itself again...
I upgraded to the dev version from 2011-Oct-06 and this did *not* fix the issue for me.
I have reverted to the fix in #7 which worked for me before - all working again now.
Comment #24
longwaveThere is a bug in eWay module if you are using PHP 5.3, see #965572: Module sending back XML data to ubercart, should send array with no Objects or string.
This needs fixing in eWay, Ubercart core can do nothing about this.
Comment #25
Anonymous (not verified) commentedThis has been fixed and committed to the uc_eway module dev version dated 2011-Oct-08.
Comment #26
armetrix commentedI ran into this problem with Drupal 6.26 and Ubercart 6x-2.9. Upon pressing submit after reviewing order in checkout we arrived at a WSOD. After reloading the page, we discovered eWay processed transactions twice and would not update order status to "payment received". We followed the instructions as outlined in #7 and all works perfectly.
Comment #27
cafuego commentedEdit: sorry, posted on the wrong issue.