Issue Bug Closed

#105996FileUpload validation may lead to uninitialized model and errors

Garvin Hicking 01/28/25, 08:29 updated 08/12/25, 14:36

Description

If an extbase model is created which solely has an optional FileUpload property required=false) addressed through <f:form> CRUD handling, the way how the FileUpload validation takes place could leave an uninitialized Entity, and fail on follow-up validation because no actual Entity could have been created.

As soon as at least one other property is involved, this problem will not occur. This means, the scenario is rather unlikely to occur in “real-life”. But developers trying out the FileUpload validation handling may only try this out with a single property and then run into problems, which is why the issue needs to be addressed.

The reason for this is related to the PropertyMapper, which does not get involved because the FileUpload property works in a differently timed aspect of object persistence.

Relevant parts of the stack-trace:

component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": 
Oops, an error occurred! Request: 4824d485f0adf- Exception: TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath(): Argument #1 ($subject) must be of type object|array, null given, called in typo3\sysext\extbase\Classes\Mvc\Controller\FileHandlingServiceConfiguration.php on line 140, in file typo3\sysext\frontend\Classes\ContentObject\ContentObjectRenderer.php:667 
- {"exception":"TypeError: TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath(): Argument #1 ($subject) must be of type object|array, null given, called in typo3\sysext\extbase\Classes\Mvc\Controller\FileHandlingServiceConfiguration.php on line 140 and defined in typo3\sysext\extbase\Classes\Reflection\ObjectAccess.php:128

Stack trace:
#0 typo3\sysext\extbase\Classes\Mvc\Controller\FileHandlingServiceConfiguration.php(140): TYPO3\CMS\Extbase\Reflection\ObjectAccess::getPropertyPath(NULL, 'singlefile')

#1 typo3\sysext\extbase\Classes\Mvc\Controller\Argument.php(329): TYPO3\CMS\Extbase\Mvc\Controller\FileHandlingServiceConfiguration->validateFileOperations(Object(TYPO3\CMS\Extbase\Mvc\Controller\Argument))

#2 typo3\sysext\extbase\Classes\Mvc\Controller\Arguments.php(268): TYPO3\CMS\Extbase\Mvc\Controller\Argument->validate()

#3 typo3\sysext\extbase\Classes\Mvc\Controller\ActionController.php(459): TYPO3\CMS\Extbase\Mvc\Controller\Arguments->validate()

#4 typo3\sysext\extbase\Classes\Mvc\Controller\ActionController.php(390): TYPO3\CMS\Extbase\Mvc\Controller\ActionController->callActionMethod(Object(TYPO3\CMS\Extbase\Mvc\Request))

#5 typo3\sysext\extbase\Classes\Mvc\Dispatcher.php(68): TYPO3\CMS\Extbase\Mvc\Controller\ActionController->processRequest(Object(TYPO3\CMS\Extbase\Mvc\Request))

#6 typo3\sysext\extbase\Classes\Core\Bootstrap.php(152): TYPO3\CMS\Extbase\Mvc\Dispatcher->dispatch(Object(TYPO3\CMS\Extbase\Mvc\Request))

#7 typo3\sysext\extbase\Classes\Core\Bootstrap.php(131): TYPO3\CMS\Extbase\Core\Bootstrap->handleFrontendRequest(Object(TYPO3\CMS\Core\Http\ServerRequest))

Reviews 2