[BUGFIX] Compatibility for finishers which set content into the response
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Classes / Domain / Runtime / FormRuntime.php
index 3c53620..373dbe1 100644 (file)
@@ -575,15 +575,22 @@ class FormRuntime implements RootRenderableInterface, \ArrayAccess
         );
 
         $output = '';
+        $originalContent = $this->response->getContent();
+        $this->response->setContent(null);
         foreach ($this->formDefinition->getFinishers() as $finisher) {
             $finisherOutput = $finisher->execute($finisherContext);
             if (is_string($finisherOutput) && !empty($finisherOutput)) {
                 $output .= $finisherOutput;
+            } else {
+                $output .= $this->response->getContent();
+                $this->response->setContent(null);
             }
+
             if ($finisherContext->isCancelled()) {
                 break;
             }
         }
+        $this->response->setContent($originalContent);
 
         return $output;
     }