-
Notifications
You must be signed in to change notification settings - Fork 43
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 #17
Comments
Are you able to put some debug in to find out what is being passed to CRM/Core/BAO/Cache.php in the $data value? public static function setItem(&$data, $group, $path, $componentID = NULL) { |
Not sure how where to put what code to debug the $data value being passed. Can you help me with the proper code to debug this? I can apply it to 4.6.18/4.7.8 & master with working Mollie ipn feedback. BTW Using civicrm's own debgging I can see the step just before the error is: |
you can stick in some code like
TEMPORARILY! |
In the cache.php file in the setitem function? |
yep |
don't leave it on prod for more than a moment though - it will break things |
I had to uncomment the die; to get to the error screen.
But succeeded in retrieving the debug data as attached in enclosed txt file. |
Still struggling with this one. A few civicrm versions further (4.7.14) and Omnipaymultiprocessor version 1.9 we still have the exact same behaviour on production and out-of-the-box new install dev-site:
I don't know where to go from here, and I wonder if someone could read something usefull in my previously submitted debug data. Any advice? What could cause a "Serialization of 'Closure'" error anyway? |
OK, got a little further with debugging:
Now why would that cause the: Exception: Serialization of 'Closure' is not allowed in serialize() in CRM/Core/BAO/Cache.php) ? |
Some more info: the debug show a Closure Object (see attached debug file) |
This looks like the closure [request.error] => Array
What strikes me about that is that a) you only experience it on event & b) it is in the error part of the guzzle http request object. I wonder if that key would not be there if some sort of error had not occurred |
I tried it locally & I see that if I output $data in this function
I get
Now in my case that is a totally valid error because I'm testing from a local user (ie. not a web accessible one) & Mollie is rightly rejecting it - but perhaps if you try similar debug you might get the actual error? |
This prevents problems caching the object
If you apply the patch I just pushed you might get better error reporting |
If you could try applying this (to 4.7.14) you would get a better error (& you could comment on the PR as to your testing to help it get merged) |
BTW Trying to debug with print_r($data);die; in FetchTransactionResponse.php does not seem work with me (does not output on screen). But when I hashout the die();-part I get: |
Sorry - it should be $this->data But before you do that - try this Omnipay patch as well #17 Also - did you comment on the Confirm.php patch to say you have tested it? |
Not sure which Omnipay patch you refer to (it link to this issue), but I was able to retrieve $this->data
|
With the patched Confirm.php the fatal error is gone and a better error message is displayed:
I commented on your PR for Confirm.php that it works nicely with me :-) |
BTW. Maybe this API-key helps :-) It is a test key of us: |
not that it helps, but same problem here |
OK -are you using
|
Same issue here... did you guys find anything yet? |
Can you please confirm when reporting this that you are using 1) the latest version of this repo from github (including . 2) the PR mentioned in the comment above. I would expect it to change the error to not refer to serialization of closure but to display the actual error. |
Richard what does your backtrace look like? @Dietermartens - what is in your civicrm_system_log table. In my tests this line
caused it to stop giving the serialisation of closure & give the real message |
I've got the exact same message as @magnolia61. But if I try now to enable the module, it shows this error. Exception: "API error: 'payment_type' is not a valid option for field option_group_id" #0 /home/kogaopvang/domains/kogaopvang.be/public_html/sites/all/modules/civicrm/CRM/Core/ManagedEntities.php(265): CRM_Core_ManagedEntities->onApiError("option_value", "create", (Array:8), (Array:6)) |
There should be a value in the civicrm_option_group table created on install
This is either missing for you or it exists but some caching has prevented it from being picked up. |
@eileenmcnaughton Using the patched Confirm.php and the current master code (with $this->gateway = NULL; in PaymentExtended.php) I do not get a backtrace, only an error mesage (and the entry in system_log which still states: ["Serialization of 'Closure' is not allowed"]) |
I guess you need to put some debug in then to figure out where that is getting logged from.... Maybe if you put a print_r(debug_backtrace());die; right before where it sets $this->gateway to null it will still hit that - otherwise - we need to figure out where the debug needs to go. Perhaps in CRM_Utils_SystemLogger::log() |
There were a couple of tables who had managed to stay in the database, that was the reason for my error. So that works now, thx! Okay so I've done that and i get this: |
@eileenmcnaughton On my staging site I was able to get a backtrace of the error. Syslog table stil mentions ["Serialization of 'Closure' is not allowed"] |
Try editing CRM_Event_Registration_Confirm and after this line
add print_r($e); To get the details about the error. It will probably be a long log and may contain confidential information (mollie account details) so you might want to redact it. |
I tried again with the debug lines at the end of Confirm.php on a local sandbox installation. It spit out the following while registering for the Fall Fundraiser Diner. (I have registered for that event so may times I actually would love to attend it now!) :-) Anyway, step by step we're nearer to finding the right haystack. Next the needle... (still amazing redirecting to Mollie works ok for regular contributions. It's the events that have the 'Serialization of 'Closure'' error) |
I'm sorry but in which file can i find the CRM_Event_Registration_Confirm class? |
I believe Eileen meant the file CRM/Event/Form/Registration/Confirm.php :-) |
I have just pushed a commit which unsets gateway before storing the session. It might help |
Hi Eileen, you found the needle in the haystack rationally. Emotionally it feels like you've found the Holy Grail :-) That said, the finish is in sight but there is still a small quirk. With your latest patch:
You can see what happens at my following dev site with the sandbox database. It uses the test-api for Mollie. It simulates, but no real monetary transaction is made. Feel free to try. |
Since the error: |
Ok - I'll close this in favour of the other as you suggest. I suspect the transactionReference might be that the invoice_id is not set or not passed to Mollie |
Hi Eileen, I'm sorry to say it, but I still have the same error. Maybe you can do something with this error dump. This is the output off the edited confirm.php ps. Thx @magnolia61 :) |
@Dieter Let's mail on this. I am glad to help you replicate the steps I took. My mail is richard(dot)van(dot)oosterhout@gmail.com |
Yes! patch is working. Cancelling the payment doesn't give me the right page, but I can communicate about that with the user for now. Thanks for the fix! |
Closing per discusson |
I had this same error using a custom omnipay plugin (https://github.com/adixon/omnipay-bluepay), one that doesn't use transparent redirect, so I had to dig a little deeper. So far, my best guess is that there really is a problem with a closure object trying to get serialized and cached, it's not just a symptom. Unsetting the gateway before the explicit session save fixes one instance, but I'd guess this issue could easily recur in some form in other places, especially during error handling (which I assume is what you were trying to sort out?). From what I can see, the closure object is in the request.error of a sympony listener, so my conclusion is that the gateway would need to be explicitly removed as soon as it's no longer needed, or else you'd want to prevent it from getting attached to whatever is getting stuffed into the session (the contribution object, I assume), or else the guzzle object would need to be discardable itself. Or of course, since the guzzle library is now deprecated, updating to whatever is supposed to replace it might make the problem just vanish. Or we could fix the civicrm session cache code to exclude any objects containing closures, which might prevent future problems at the cost of some messy debugging if the object really needed to be cached. |
Yep - the situation I was hitting was during error handling, but I actually think unsetting the gateway is probably good security practice too |
Not sure if this is Mollie specific but in civicrm 4.7 our working Mollie implementation stopped working for event registrations (regular contributions still work ok).
Sorry, there was an error processing your payment. Please try again later.
Exception: Serialization of 'Closure' is not allowed in serialize() (line 162 of /home/xyz/domains/onvergetelijk.nl/public_html/civisand/sites/all/modules/civicrm/CRM/Core/BAO/Cache.php).
Uncaught exception thrown in shutdown function.
Exception: Serialization of 'Closure' is not allowed in session_write_close() (line 3501 of /home/xyz/domains/onvergetelijk.nl/public_html/civisand/includes/bootstrap.inc).
I tested this with civicrm 4.7.0, 4.7.8 and the current master code (~4.7.9).
I am trying to do some further tests but at this moment have no clue which haystack to start searching the needle in (symfony? php session settings? core code difference for contributions and events?)
phpMyAdmin civicrm_system_log says:
Fall Fundraiser Diner on 4.7.0 with sandbox demo data and Mollie Test config (will simulate payment)
https://civisand.onvergetelijk.nl/civicrm/event/register?reset=1&id=1
Working demo on 4.6.18 (simulates payment, no real payment is made)
https://civilongterm.onvergetelijk.nl/civicrm/event/register?reset=1&id=71
The text was updated successfully, but these errors were encountered: