From 5d2fae27d4b55fa3226979b0d46b1ff209b40a87 Mon Sep 17 00:00:00 2001
From: Garvin Hicking <gh@faktor-e.de>
Date: Wed, 12 Jun 2024 13:33:34 +0200
Subject: [PATCH] [DOCS] Note about reserved keywords for Extbase arguments
 ("format")

Extbase reserves a couple of keywords for internal use:

* action
* controller
* format (resolving fluid templates for HTML, json, ...)
* __trustedProperties
* __referrer

The notiation "__" (and "@" for sub-arrays) is indiciative
of being reserved keywords, however action/controller/format
are not.

These are now mentioned specifically in the Fluid ViewHelper
"arguments" parameter, so that they can show up in the
auto-generated documentation.

This should help to prevent integrators and developers from
advertly using an argument like "format" as a custom
variable/property name.

Efforts have been made to document this also here:

https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-CoreApi/pull/4525
https://github.com/TYPO3-Documentation/TYPO3CMS-Exceptions/pull/155

Resolves: #102246
Releases: main, 12.4, 11.5
Change-Id: I55a306aaa0ba783f9202350d198c9fdf08f5a997
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84674
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php       | 2 +-
 .../sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php  | 2 +-
 typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
index 2313314f55fa..acdc64b07975 100644
--- a/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
+++ b/typo3/sysext/fluid/Classes/ViewHelpers/FormViewHelper.php
@@ -117,7 +117,7 @@ class FormViewHelper extends AbstractFormViewHelper
     {
         parent::initializeArguments();
         $this->registerArgument('action', 'string', 'Target action');
-        $this->registerArgument('arguments', 'array', 'Arguments', false, []);
+        $this->registerArgument('arguments', 'array', 'Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)', false, []);
         $this->registerArgument('controller', 'string', 'Target controller');
         $this->registerArgument('extensionName', 'string', 'Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used');
         $this->registerArgument('pluginName', 'string', 'Target plugin. If empty, the current plugin name is used');
diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php
index e5c516d70724..7bab171eb43d 100644
--- a/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php
+++ b/typo3/sysext/fluid/Classes/ViewHelpers/Link/ActionViewHelper.php
@@ -68,7 +68,7 @@ class ActionViewHelper extends AbstractTagBasedViewHelper
         $this->registerArgument('addQueryString', 'bool', 'If set, the current query parameters will be kept in the URI');
         $this->registerArgument('argumentsToBeExcludedFromQueryString', 'array', 'Arguments to be removed from the URI. Only active if $addQueryString = TRUE');
         $this->registerArgument('addQueryStringMethod', 'string', 'This argument is not evaluated anymore and will be removed in TYPO3 v12.');
-        $this->registerArgument('arguments', 'array', 'Arguments for the controller action, associative array');
+        $this->registerArgument('arguments', 'array', 'Arguments for the controller action, associative array (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)');
     }
 
     /**
diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php
index b738478a2734..afc1eec2601c 100644
--- a/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php
+++ b/typo3/sysext/fluid/Classes/ViewHelpers/Uri/ActionViewHelper.php
@@ -44,7 +44,7 @@ class ActionViewHelper extends AbstractViewHelper
     public function initializeArguments()
     {
         $this->registerArgument('action', 'string', 'Target action');
-        $this->registerArgument('arguments', 'array', 'Arguments', false, []);
+        $this->registerArgument('arguments', 'array', 'Arguments (do not use reserved keywords "action", "controller" or "format" if not referring to these internal variables specifically)', false, []);
         $this->registerArgument('controller', 'string', 'Target controller. If NULL current controllerName is used');
         $this->registerArgument('extensionName', 'string', 'Target Extension Name (without `tx_` prefix and no underscores). If NULL the current extension name is used');
         $this->registerArgument('pluginName', 'string', 'Target plugin. If empty, the current plugin name is used');
-- 
GitLab