Problem
Adding a "FlowDrop Workflow" action to any field widget on a form that also contains a managed_file/file widget (e.g. /media/add/document) makes the form crash on file upload with:
Exception: Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed
in serialize() (line 14 of core/lib/Drupal/Component/Serialization/PhpSerialize.php).
#3 core/lib/Drupal/Core/Form/FormCache.php(181):
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire()
#5 core/lib/Drupal/Core/Form/FormBuilder.php(462):
Drupal\Core\Form\FormBuilder->setCache()
#6 core/lib/Drupal/Core/Form/FormBuilder.php(651):
Drupal\Core\Form\FormBuilder->rebuildForm()
Root cause
FieldWidgetActionBase::actionButton() attaches '#ajax' => ['callback' => [$this, $this->getAjaxCallback()]] to the button it renders. $this is the FlowDropWorkflowAction plugin instance, which gets serialized into the form
cache on every form rebuild (e.g. managed_file's upload AJAX).
Two issues compound
1. FlowDropWorkflowAction does not use DependencySerializationTrait, so PHP recursively serializes every injected service (entity type manager, orchestrator, logger, …). Each of those transitively references the current
Request, which carries the UploadedFile for the in-progress upload.
2. Even after adding DependencySerializationTrait, one injected property still fails: protected LoggerChannelInterface $logger. It is built via logger.factory->get('flowdrop_field_widget_actions') and is not itself a
registered container service, so ReverseContainer::getId() returns NULL and the trait cannot reduce it. The trait leaves the LoggerChannel object intact, PHP serializes it, and its internal RequestStack drags UploadedFile
into the graph → crash.
Fix
In FlowDropWorkflowAction:
1. use DependencySerializationTrait.
2. Inject LoggerChannelFactoryInterface (the actual container service logger.factory) instead of a LoggerChannelInterface. Resolve the channel lazily via a getLogger() helper.
A secondary bug surfaced once the upload worked: FieldContentProcessor::extractSingleFieldItem() does not handle the managed_file widget's form-state shape (['fids' => [...]]), so file-field values silently disappear from
the extracted context.
Steps to reproduce
1. Install flowdrop_field_widget_actions.
2. On a Media document (or any bundle with both a file field and a text field) form display, enable the "FlowDrop Workflow" action on the text field.
3. Visit /media/add/document, attach a PDF/file → fatal.
AI Disclaimer
AI has been used to help crafting both the ticket description and the fix.
I have reviewed both before posting :)
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screenshot 2026-05-14 at 11.48.00.png | 41.98 KB | gxleano |
| #5 | Screenshot 2026-05-14 at 11.47.23.png | 274.16 KB | gxleano |
Issue fork flowdrop_field_widget_actions-3590064
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
marcoscanoComment #5
gxleano commentedThank you very much Marcos, to point this out!
I have been testing locally, and everything seems to be working fine.
Workflow
Suggestions
Comment #6
gxleano commentedComment #7
gxleano commentedIt will be part of the next release
1.0.1Comment #8
gxleano commented