- Issue created by @mgifford
- @anjaliprasannan opened merge request.
- 🇮🇳India anjaliprasannan
Fix the issue and no ajax error in console.
Please review
Note, the error is mostly generated by ChatGPT but I have reviewed it and hope I've clarified things.
When editing a content node (e.g., /node/1/edit
) using the CKEditor integration that includes AI modules (e.g., AI Image generation or insertion), and while the Autosave Form module is enabled, an AJAX modal fails to open correctly.
An error occurs because the form handling attempts to serialize a Symfony\Component\HttpFoundation\File\UploadedFile
object, which is not serializable by PHP.
As a result, the user sees an AJAX error with an HTTP 500 status, and the form submission fails.
The critical error message is:
Exception: Serialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed in serialize() (line 14 of core/lib/Drupal/Component/Serialization/PhpSerialize.php)
This happens when the form tries to cache or autosave a form state that includes an UploadedFile object without first handling it properly.
ai
and a LLM Provider like ai_provider_google_vertex
)./node/[nid]/edit
.serialize()
on UploadedFile
.UploadedFile
object directly into form state.file_save_upload()
.UploadedFile
object into the form state.FormStateInterface::cleanValues()
for best practices.file_save_upload()
and only storing File entity references instead of full file objects.file
entities and the existing file system.Active
1.0
Code
Fix the issue and no ajax error in console.
Please review