From 61d2457eb3d8d18eddd9a14c9502dfabb8f16092 Mon Sep 17 00:00:00 2001
From: Simon Praetorius <simon@praetorius.me>
Date: Wed, 11 Sep 2024 11:22:36 +0200
Subject: [PATCH] [FEATURE] Raise Fluid Standalone to 4.0
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This patch raises the minimum Fluid dependency to the just
released Fluid 4. The Fluid team has taken great care to
plan this switch in the Core by introducing a lot of changes
in advance, both with minor releases of Fluid 2 and code
changes in the Core to avoid now deprecated Fluid features.
There are no new deprecations with this release. All
deprecations have already been announced and documented
in previous raises of Fluid 2.x in the Core.

One recently added test case needs to be adjusted with this
change to account for the feature described in the attached
feature RST file.

For a full changelog and more information about the release,
dedicated release notes are available on GitHub:
https://github.com/TYPO3/Fluid/releases/tag/4.0.0

Executed commands:

```
composer req typo3fluid/fluid:^4.0
composer req -d typo3/sysext/adminpanel --no-update typo3fluid/fluid:^4.0
composer req -d typo3/sysext/core --no-update typo3fluid/fluid:^4.0
composer req -d typo3/sysext/fluid --no-update typo3fluid/fluid:^4.0
composer req -d typo3/sysext/redirects --no-update typo3fluid/fluid:^4.0
```

Resolves: #104896
Releases: main
Change-Id: Ia40b2a62ba43303bdc094f763e103465a0d5a03e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/86008
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Simon Praetorius <simon@praetorius.me>
Tested-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Simon Praetorius <simon@praetorius.me>
---
 composer.json                                 |  2 +-
 composer.lock                                 | 22 ++++---
 typo3/sysext/adminpanel/composer.json         |  2 +-
 ...eature-104896-RaiseFluidStandaloneTo40.rst | 62 +++++++++++++++++++
 typo3/sysext/core/composer.json               |  2 +-
 .../Form/TextareaViewHelperTest.php           |  4 +-
 typo3/sysext/fluid/composer.json              |  2 +-
 typo3/sysext/redirects/composer.json          |  2 +-
 8 files changed, 81 insertions(+), 17 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/13.3/Feature-104896-RaiseFluidStandaloneTo40.rst

diff --git a/composer.json b/composer.json
index 4e2b1bffad6a..60d03464a9cc 100644
--- a/composer.json
+++ b/composer.json
@@ -104,7 +104,7 @@
 		"typo3/cms-cli": "^3.1.1",
 		"typo3/cms-composer-installers": "^5.0.1",
 		"typo3/html-sanitizer": "^2.2.0",
-		"typo3fluid/fluid": "^2.15"
+		"typo3fluid/fluid": "^4.0"
 	},
 	"require-dev": {
 		"bnf/phpstan-psr-container": "^1.0.1",
diff --git a/composer.lock b/composer.lock
index 1ba188ae215f..5d5e34d4d59b 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "6981656346ae34f00a715da38913e1e1",
+    "content-hash": "fe8921ba17dcc61f9b234440cce66a6a",
     "packages": [
         {
             "name": "bacon/bacon-qr-code",
@@ -4877,29 +4877,31 @@
         },
         {
             "name": "typo3fluid/fluid",
-            "version": "2.15.0",
+            "version": "4.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/Fluid.git",
-                "reference": "0a8ebdb9bab1510380f18bef6395fbb4754c01b7"
+                "reference": "a5d7bd3134035639106cb783681f04cc0f91294d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/Fluid/zipball/0a8ebdb9bab1510380f18bef6395fbb4754c01b7",
-                "reference": "0a8ebdb9bab1510380f18bef6395fbb4754c01b7",
+                "url": "https://api.github.com/repos/TYPO3/Fluid/zipball/a5d7bd3134035639106cb783681f04cc0f91294d",
+                "reference": "a5d7bd3134035639106cb783681f04cc0f91294d",
                 "shasum": ""
             },
             "require": {
                 "ext-mbstring": "*",
-                "php": "^8.1"
+                "php": "^8.2"
             },
             "require-dev": {
                 "ext-json": "*",
                 "ext-simplexml": "*",
                 "friendsofphp/php-cs-fixer": "^3.59.3",
-                "phpstan/phpstan": "^1.10.14",
-                "phpstan/phpstan-phpunit": "^1.3.11",
-                "phpunit/phpunit": "^10.2.6"
+                "phpstan/phpstan": "^1.11.5",
+                "phpstan/phpstan-phpunit": "^1.4.0",
+                "phpunit/phpunit": "^11.2.5",
+                "psr/container": "^2.0",
+                "t3docs/fluid-documentation-generator": "^4.3"
             },
             "suggest": {
                 "ext-json": "PHP JSON is needed when using JSONVariableProvider: A relatively rare use case",
@@ -4925,7 +4927,7 @@
                 "issues": "https://github.com/TYPO3/Fluid/issues",
                 "source": "https://github.com/TYPO3/Fluid"
             },
-            "time": "2024-08-30T21:24:26+00:00"
+            "time": "2024-09-10T16:15:31+00:00"
         },
         {
             "name": "webmozart/assert",
diff --git a/typo3/sysext/adminpanel/composer.json b/typo3/sysext/adminpanel/composer.json
index 3987850b9602..ef98d2366506 100644
--- a/typo3/sysext/adminpanel/composer.json
+++ b/typo3/sysext/adminpanel/composer.json
@@ -27,7 +27,7 @@
 		"typo3/cms-core": "13.3.*@dev",
 		"typo3/cms-fluid": "13.3.*@dev",
 		"typo3/cms-frontend": "13.3.*@dev",
-		"typo3fluid/fluid": "^2.15"
+		"typo3fluid/fluid": "^4.0"
 	},
 	"conflict": {
 		"typo3/cms": "*"
diff --git a/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104896-RaiseFluidStandaloneTo40.rst b/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104896-RaiseFluidStandaloneTo40.rst
new file mode 100644
index 000000000000..ab6894151a36
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104896-RaiseFluidStandaloneTo40.rst
@@ -0,0 +1,62 @@
+.. include:: /Includes.rst.txt
+
+.. _feature-104896-1726046146:
+
+================================================
+Feature: #104896 - Raise Fluid Standalone to 4.0
+================================================
+
+See :issue:`104896`
+
+Description
+===========
+
+TYPO3 13 now uses Fluid 4 as the new base version. Old TYPO3 versions
+will keep using Fluid 2, which will still receive bugfixes if necessary.
+For detailed information about this release, please refer to the
+`dedicated release notes on GitHub <https://github.com/TYPO3/Fluid/releases/tag/4.0.0>`_.
+
+With the update to Fluid 4, tag-based ViewHelpers now have proper
+support for boolean attributes. Before this change, it was very
+cumbersome to generate these with Fluid, now it's implemented similar
+to popular JavaScript frameworks by using the newly introduced
+boolean literals:
+
+..  code-block:: html
+
+    <my:viewhelper async="{true}" />
+    Result: <tag async="async" />
+
+    <my:viewhelper async="{false}" />
+    Result: <tag />
+
+
+Of course, any variable containing a boolean can be supplied as well:
+
+..  code-block:: html
+
+    <my:viewhelper async="{isAsync}" />
+
+
+This can also be used in combination with variable casting:
+
+..  code-block:: html
+
+    <my:viewhelper async="{myString as boolean}" />
+
+
+For compatibility reasons empty strings still lead to the attribute
+being omitted from the tag.
+
+
+Impact
+======
+
+For existing installations, negative consequences of this update should be
+minimal as deprecated features will still work. Users are however advised
+to look into the already announced deprecations and to update their code
+accordingly. This update helps with this by now writing log messages to the
+deprecation log (if activated) if any deprecated feature is used in the
+TYPO3 instance.
+
+.. index:: Fluid, ext:fluid
diff --git a/typo3/sysext/core/composer.json b/typo3/sysext/core/composer.json
index d30c6b59d802..5855661ffa28 100644
--- a/typo3/sysext/core/composer.json
+++ b/typo3/sysext/core/composer.json
@@ -74,7 +74,7 @@
 		"typo3/cms-cli": "^3.1.1",
 		"typo3/cms-composer-installers": "^5.0.1",
 		"typo3/html-sanitizer": "^2.2.0",
-		"typo3fluid/fluid": "^2.15"
+		"typo3fluid/fluid": "^4.0"
 	},
 	"suggest": {
 		"ext-apcu": "Needed when non-default APCU based cache backends are used",
diff --git a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/TextareaViewHelperTest.php b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/TextareaViewHelperTest.php
index 6e249015d679..6b6814cc7445 100644
--- a/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/TextareaViewHelperTest.php
+++ b/typo3/sysext/fluid/Tests/Functional/ViewHelpers/Form/TextareaViewHelperTest.php
@@ -75,12 +75,12 @@ final class TextareaViewHelperTest extends FunctionalTestCase
             'renderAddsReadonlyTrue' => [
                 '<f:form.textarea name="NameOfTextarea" readonly="{var}" />',
                 ['var' => true],
-                '<textarea readonly="1" name="NameOfTextarea"></textarea>',
+                '<textarea readonly="readonly" name="NameOfTextarea"></textarea>',
             ],
             'renderAddsReadonlyFalse' => [
                 '<f:form.textarea name="NameOfTextarea" readonly="{var}" />',
                 ['var' => false],
-                '<textarea readonly="" name="NameOfTextarea"></textarea>',
+                '<textarea name="NameOfTextarea"></textarea>',
             ],
             'renderAddsReadonlyNull' => [
                 '<f:form.textarea name="NameOfTextarea" readonly="{var}" />',
diff --git a/typo3/sysext/fluid/composer.json b/typo3/sysext/fluid/composer.json
index 026195c01b20..fd40f45de452 100644
--- a/typo3/sysext/fluid/composer.json
+++ b/typo3/sysext/fluid/composer.json
@@ -22,7 +22,7 @@
 		"symfony/dependency-injection": "^7.1.4",
 		"typo3/cms-core": "13.3.*@dev",
 		"typo3/cms-extbase": "13.3.*@dev",
-		"typo3fluid/fluid": "^2.15"
+		"typo3fluid/fluid": "^4.0"
 	},
 	"conflict": {
 		"typo3/cms": "*"
diff --git a/typo3/sysext/redirects/composer.json b/typo3/sysext/redirects/composer.json
index 880b67010f28..7dc9aeed891f 100644
--- a/typo3/sysext/redirects/composer.json
+++ b/typo3/sysext/redirects/composer.json
@@ -25,7 +25,7 @@
 		"symfony/console": "^7.1.4",
 		"typo3/cms-backend": "13.3.*@dev",
 		"typo3/cms-core": "13.3.*@dev",
-		"typo3fluid/fluid": "^2.15"
+		"typo3fluid/fluid": "^4.0"
 	},
 	"conflict": {
 		"typo3/cms": "*"
-- 
GitLab