Exception: Serialization of 'Closure' is not allowed

Created on 27 May 2021, over 3 years ago
Updated 11 April 2024, 10 months ago

Problem/Motivation

When uploading a file through an image effect form (Drupal\image\ConfigurableImageEffectBase), the AJAX request breaks with the following error:

Exception: Serialization of 'Closure' is not allowed

I was able to track down the cause: the request_stack service being serialized. I think the root cause is actually a Symfony\Component\HttpFoundation\File\UploadedFile object in the current request.

Steps to reproduce

Create a configurable image effect with a managed_file in its configuration form.

Proposed resolution

I fixed this issue by including DependencySerializationTrait in ImageEffectBase and by directly injecting logger.channel.image instead of getting it from the logger factory, since this way the logger can be serialized.

Remaining tasks

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Image systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

Production build 0.71.5 2024