Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mollie with Event payment: Serialization of 'Closure' is not allowed when using Redis #55

Closed
wannesderoy opened this issue Aug 3, 2018 · 7 comments

Comments

@wannesderoy
Copy link

wannesderoy commented Aug 3, 2018

In reference to issue #17 we encountered the same issue but only when using Redis caching.
We looked at all the solutions and patches suggested in #17 but to no avail.
We only use Mollie on our site so can't confirm for other payment providers.
A registration for an event is registered correctly by civi and the user is redirected to and from Mollie corrected, but the status of the payment always remains on "Pending (incomplete transaction)". If we set the cache to ArrayCache, everything works correctly.
In the logs we see for example:

...
Aug 03 11:10:27  [error] ipn_completion failed
Array
(
    [0] => 38Serialization of 'Closure' is not allowed
)
...

Something is still going wrong with the storage of session or cache data. We already spend some time looking into this issue but found nothing out of the ordinary except the Serialization of 'Closure' is not allowederror.

@wannesderoy
Copy link
Author

I found that the mollie vendor uses a Closure or anonymous function in the AbstractRequest class. This Closures bubbles down through the omnipay extension to the cache somewhere somehow and that can't be serialized. I'm not sure if this should be fixed in mollie vendor or omnipay extension or CiviCRM core maybe?

@eileenmcnaughton
Copy link
Owner

Hmm - so the previous fix was to unset the gateway object before the form was going to be serialised - ie https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/CRM/Core/Payment/OmnipayMultiProcessor.php#L1000

So doing it in the completetransaction routine too makes sense - pushed a commit that does that

@eileenmcnaughton
Copy link
Owner

As an aside- if you are doing Redis there are changes in the current rc that affect Redis caching so it would be great if you could test it https://download.civicrm.org/latest

@wannesderoy
Copy link
Author

Thanks @eileenmcnaughton your fix seems to work on my setup! I will test further and more in depth later with my teammates and give you an update.
I'll definitely test the current rc for Redis caching.

@eileenmcnaughton
Copy link
Owner

Thanks @wannesderoy

eileenmcnaughton added a commit to eileenmcnaughton/civicrm-core that referenced this issue Aug 6, 2018
I am hitting a slightly obscure bug in Redis that is solved by this change.

Per eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor#55
we have an issue whereby Omnipay adds the gateway to a variable on class when processing payments.

In some cases this gateway will not serialize into a key under Redis causing a fatal.

However, we don't really need it to - the payment processor that we are aiming to cache is
'as loaded' not 'as used'. The caching of the processors appears to have been removed in
the past because of issues around domains -however, I think we can get
past that by changing the cache key.
@eileenmcnaughton
Copy link
Owner

I hit this on another processor with Redis (which I'm now using locally) - Mollie seems to just sneak through with this patch but Paypal Rest I needed to address it in the caching function because completetransaction is being called from the form so I have less control.

civicrm/civicrm-core#12627

xurizaemon pushed a commit to civicrm/civicrm-core that referenced this issue Aug 10, 2018
I am hitting a slightly obscure bug in Redis that is solved by this change.

Per eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor#55
we have an issue whereby Omnipay adds the gateway to a variable on class when processing payments.

In some cases this gateway will not serialize into a key under Redis causing a fatal.

However, we don't really need it to - the payment processor that we are aiming to cache is
'as loaded' not 'as used'. The caching of the processors appears to have been removed in
the past because of issues around domains -however, I think we can get
past that by changing the cache key.
mattwire pushed a commit to mattwire/civicrm-core that referenced this issue Aug 22, 2018
I am hitting a slightly obscure bug in Redis that is solved by this change.

Per eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor#55
we have an issue whereby Omnipay adds the gateway to a variable on class when processing payments.

In some cases this gateway will not serialize into a key under Redis causing a fatal.

However, we don't really need it to - the payment processor that we are aiming to cache is
'as loaded' not 'as used'. The caching of the processors appears to have been removed in
the past because of issues around domains -however, I think we can get
past that by changing the cache key.
@eileenmcnaughton
Copy link
Owner

OK I think we sorted this out - closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants