Previewing a node with a Payment form field causes an exception.
Exception: Serialization of 'Closure' is not allowed in serialize() (line 14 of core/lib/Drupal/Component/Serialization/PhpSerialize.php).
Steps to reproduce
- Enable Payment form +dependecies
- add the payment form field to any entity form
- create or edit an entity with that field
- click Preview button
Expected result
A preview of the content.
Actual result
The website encountered an unexpected error. Please try again later.
Exception: Serialization of 'Closure' is not allowed in serialize() (line 14 of core/lib/Drupal/Component/Serialization/PhpSerialize.php).
Proposed solution
The preview function tries to serialize the form state. Anonymous functions can't get serialized. The payment form module uses two anonymous functions for an element validate and a submit function.
I provided a patch which fixes these problems.
Important
In case the preview function still does not work after applying the patch check this issue: https://www.drupal.org/node/2325463
Comment | File | Size | Author |
---|---|---|---|
fix_preview.patch | 3.33 KB | Ayrmax | |
Comments
Comment #2
Ayrmax CreditAttribution: Ayrmax commentedComment #3
Ayrmax CreditAttribution: Ayrmax commentedComment #4
Berdirneeds at least some basic documentation on those new methods.