Serialization of 'Closure' is not allowed

Created on 23 August 2022, almost 2 years ago
Updated 11 April 2023, about 1 year ago

Problem/Motivation

When the library is loaded, the libraries module tries to cache it and the following error occurs: Serialization of 'Closure' is not allowed.

Steps to reproduce

Install libraries 2 xautoload 4 and mollie_payment 2. Install the mollie-api-php as per README instructions. Create a payment and execute.

Proposed resolution

I don't know where the closure comes from. Apparently this is possible when an unnamed function is trying to be serialized (this happens when the library is stored in cache). I also noted there was a \Closure class in the autoload file of the library. Possible solution is looking if this closure is needed or if another closure is used elsewhere. Perhaps making sure the library is not cached if possible, e.g. by not using libraries module?

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium tcorneli Merelbeke

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡±Netherlands MegaChriz

    I encountered the same issue initially after updating from Mollie Payment 7.x-1.1 and when I tried to complete checkout. Then I went to admin/modules and I saw that X Autoload wasn't yet enabled (I had enabled it on a local install, but I had forgotten to do so on the staging environment).

    I flushed caches and tried to complete checkout again. This time I got the following error:

    ParseError: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in Drupal\xautoload\ClassFinder\InjectedApi\LoadClassInjectedAPI->suggestFile() (regel 46 van /data/sites/web/vcaexamentrainingnl/subsites/staging.vcaexamentraining.nl/sites/all/libraries/mollie-api-php/src/MollieApiClient.php).

    I had PHP 7.0 still active, because locally - on higher PHP versions - I encountered some other issues, such as "EntityMetadataWrapperException: Unknown data property commerce_product.".
    So because of that I decided to upgrade the server to PHP 7.2. Now it appears to be working correctly. At least on the staging environment.

Production build 0.69.0 2024