[BUGFIX] Only list valid forms 11/57111/3
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Thu, 31 May 2018 20:05:27 +0000 (22:05 +0200)
committerJan Helke <typo3@helke.de>
Fri, 1 Jun 2018 14:54:12 +0000 (16:54 +0200)
Only list valid forms within the form manger and the form plugin.

Valid forms have an "identifier" and a "type" and the type must be "Form".

Resolves: #85132
Releases: master, 8.7
Change-Id: I2f473925b3edf839d5f965136b6b02030671350a
Reviewed-on: https://review.typo3.org/57111
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php

index 45d863e..c6f0456 100644 (file)
@@ -253,18 +253,20 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
                 $persistenceIdentifier = $storage->getUid() . ':' . $file->getIdentifier();
 
                 $form = $this->load($persistenceIdentifier);
-                $forms[] = [
-                    'identifier' => $form['identifier'],
-                    'name' => isset($form['label']) ? $form['label'] : $form['identifier'],
-                    'persistenceIdentifier' => $persistenceIdentifier,
-                    'readOnly' => false,
-                    'removable' => true,
-                    'location' => 'storage',
-                    'duplicateIdentifier' => false,
-                    'invalid' => $form['invalid'],
-                    'error' => $form['error'],
-                ];
-                $identifiers[$form['identifier']]++;
+                if (isset($form['identifier'], $form['type']) && $form['type'] === 'Form') {
+                    $forms[] = [
+                        'identifier' => $form['identifier'],
+                        'name' => $form['label'] ?? $form['identifier'],
+                        'persistenceIdentifier' => $persistenceIdentifier,
+                        'readOnly' => $formReadOnly,
+                        'removable' => true,
+                        'location' => 'storage',
+                        'duplicateIdentifier' => false,
+                        'invalid' => $form['invalid'],
+                        'error' => $form['error'],
+                    ];
+                    $identifiers[$form['identifier']]++;
+                }
             }
             $storage->resetFileAndFolderNameFiltersToDefault();
         }
@@ -276,18 +278,20 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
                     continue;
                 }
                 $form = $this->load($relativePath . $fileInfo->getFilename());
-                $forms[] = [
-                    'identifier' => $form['identifier'],
-                    'name' => isset($form['label']) ? $form['label'] : $form['identifier'],
-                    'persistenceIdentifier' => $relativePath . $fileInfo->getFilename(),
-                    'readOnly' => $this->formSettings['persistenceManager']['allowSaveToExtensionPaths'] ? false: true,
-                    'removable' => $this->formSettings['persistenceManager']['allowDeleteFromExtensionPaths'] ? true: false,
-                    'location' => 'extension',
-                    'duplicateIdentifier' => false,
-                    'invalid' => $form['invalid'],
-                    'error' => $form['error'],
-                ];
-                $identifiers[$form['identifier']]++;
+                if (isset($form['identifier'], $form['type']) && $form['type'] === 'Form') {
+                    $forms[] = [
+                        'identifier' => $form['identifier'],
+                        'name' => $form['label'] ?? $form['identifier'],
+                        'persistenceIdentifier' => $relativePath . $fileInfo->getFilename(),
+                        'readOnly' => $this->formSettings['persistenceManager']['allowSaveToExtensionPaths'] ? false: true,
+                        'removable' => $this->formSettings['persistenceManager']['allowDeleteFromExtensionPaths'] ? true: false,
+                        'location' => 'extension',
+                        'duplicateIdentifier' => false,
+                        'invalid' => $form['invalid'],
+                        'error' => $form['error'],
+                    ];
+                    $identifiers[$form['identifier']]++;
+                }
             }
         }