From 27c65c73db07b9987ec6d3f1983da418e560a6db Mon Sep 17 00:00:00 2001 From: Stefan Galinski <stefan@sgalinski.de> Date: Thu, 14 Nov 2019 00:41:10 +0100 Subject: [PATCH] [BUGFIX] Fix crash if form is saved in form_definitions --- Classes/XClass/Form/FormEditorController.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/XClass/Form/FormEditorController.php b/Classes/XClass/Form/FormEditorController.php index 5517c928..56e4faf3 100644 --- a/Classes/XClass/Form/FormEditorController.php +++ b/Classes/XClass/Form/FormEditorController.php @@ -63,8 +63,8 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll * * @param string $formPersistenceIdentifier * @param FormDefinitionArray $formDefinition - * @internal * @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException + * @internal */ public function saveFormAction(string $formPersistenceIdentifier, FormDefinitionArray $formDefinition) { $registrationService = $this->objectManager->get(RegisterService::class); @@ -116,10 +116,16 @@ class FormEditorController extends \TYPO3\CMS\Form\Controller\FormEditorControll sprintf('Could not access storage with uid "%d".', $storageUid) ); } - $absoluteFilePath = $storage->getFile($fileIdentifier); + $absoluteFilePath = PATH_site . $storage->getFile($fileIdentifier)->getPublicUrl(); } - $parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath)); + try { + $parsedYaml = Yaml::parse(file_get_contents($absoluteFilePath)); + } catch (\Exception $exception) { + throw new \InvalidArgumentException( + sprintf('Could not access storage "%s".', $absoluteFilePath) + ); + } $renderables = self::getFormFieldsRecursive([0 => $parsedYaml]); -- GitLab