Issue Bug Under Review

#111508EXT:form: uncaught FileDoesNotExistException when an older form page refers to a removed upload

Tung Ngo 11/19/26, 14:23 updated 11/19/26, 15:54

Description

TYPO3 14.3.12. A multi-step form with a FileUpload/ImageUpload field. If an uploaded file is deleted while an older page of the form is still open (browser history), submitting that page ends in an uncaught TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException (#1317178604, “No file found for given UID”).

Steps to reproduce:

Upload a file on a step with an upload field (allowRemoval: true), go to the next step, then “Previous”. The file is shown with “Remove”.
Keep a copy of this page (browser history), tick “Remove” and submit. The file is deleted.
Submit the older copy from step 2 again.

The same happens when the file was deleted by the DeleteUploads finisher, the uploads cleanup command or in the file list.

Cause: the serialized form state (__state) contains the upload. PseudoFileReference::__wakeup() loads the file without handling a missing file (stack: FormRuntime::initializeFormStateFromRequest() → unserialize() → PseudoFileReference::__wakeup() → ResourceFactory::createFileReferenceObject()). After that, UploadedFileReferenceConverter::convertSingleUpload() loads the file again from the submitted resource pointer and only catches \InvalidArgumentException.

Expected: the missing upload is dropped and the field is empty, so a required field shows its normal validation error.

Fix: PseudoFileReference::__wakeup() catches ResourceDoesNotExistException and marks the reference as missing; FormRuntime drops missing references after restoring the form state; UploadedFileReferenceConverter::convertSingleUpload() also catches ResourceDoesNotExistException.

Reviews 1

Files 1

History 12