[BUGFIX] FormViewHelper can handle empty string as pageUid 25/49825/2
authorFrans Saris <franssaris@gmail.com>
Fri, 2 Sep 2016 16:17:55 +0000 (18:17 +0200)
committerFrans Saris <franssaris@gmail.com>
Sat, 3 Sep 2016 10:24:00 +0000 (12:24 +0200)
The FormViewHelper now can handle a empty string value passed through
the pageUid attribute and handles is as value not set so current pageUid
is used.

Resolves: #77793
Releases: master, 7.6
Change-Id: Iff857badca0ae68b4fbb907b8c394c39306542ca
Reviewed-on: https://review.typo3.org/49825
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php

index eded25b..9176b3b 100644 (file)
@@ -196,7 +196,8 @@ class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewH
             $formActionUri = $this->arguments['actionUri'];
         } else {
             $uriBuilder = $this->controllerContext->getUriBuilder();
-            $formActionUri = $uriBuilder->reset()->setTargetPageUid($this->arguments['pageUid'])->setTargetPageType($this->arguments['pageType'])->setNoCache($this->arguments['noCache'])->setUseCacheHash(!$this->arguments['noCacheHash'])->setSection($this->arguments['section'])->setCreateAbsoluteUri($this->arguments['absolute'])->setArguments((array)$this->arguments['additionalParams'])->setAddQueryString($this->arguments['addQueryString'])->setArgumentsToBeExcludedFromQueryString((array)$this->arguments['argumentsToBeExcludedFromQueryString'])->setFormat($this->arguments['format'])->uriFor($this->arguments['action'], $this->arguments['arguments'], $this->arguments['controller'], $this->arguments['extensionName'], $this->arguments['pluginName']);
+            $pageUid = (int)$this->arguments['pageUid'] > 0 ? (int)$this->arguments['pageUid'] : null;
+            $formActionUri = $uriBuilder->reset()->setTargetPageUid($pageUid)->setTargetPageType($this->arguments['pageType'])->setNoCache($this->arguments['noCache'])->setUseCacheHash(!$this->arguments['noCacheHash'])->setSection($this->arguments['section'])->setCreateAbsoluteUri($this->arguments['absolute'])->setArguments((array)$this->arguments['additionalParams'])->setAddQueryString($this->arguments['addQueryString'])->setArgumentsToBeExcludedFromQueryString((array)$this->arguments['argumentsToBeExcludedFromQueryString'])->setFormat($this->arguments['format'])->uriFor($this->arguments['action'], $this->arguments['arguments'], $this->arguments['controller'], $this->arguments['extensionName'], $this->arguments['pluginName']);
             $this->formActionUriArguments = $uriBuilder->getArguments();
         }
         $this->tag->addAttribute('action', $formActionUri);