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.
Create a configurable image effect with a managed_file
in its configuration form.
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.
Needs work
11.0 π₯
The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.