From 1529e993730aa80cabc50091f8f5cbf30043f994 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Fri, 20 Nov 2020 12:37:03 +0100
Subject: [PATCH] [TASK] Raise PHP requirements to PHP 7.4

The PHP version that is required now, is PHP 7.4,
more specifically PHP 7.4.1, which fixed a
hard issue on the JIT compiler.

Used composer commands:
composer config platform.php 7.4.1
composer req php:^7.4
composer req php:^7.4 -d typo3/sysext/core --no-lock

Releases: master
Resolves: #92890
Change-Id: Iaf090b34b1f825adcdb5d42e8a4df20673677a6f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66717
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 Build/Scripts/runTests.sh                     | 28 +++++++++----------
 composer.json                                 |  4 +--
 composer.lock                                 |  6 ++--
 .../backend/Resources/Private/Php/backend.php |  4 +--
 typo3/sysext/core/composer.json               |  2 +-
 .../Resources/Private/Php/frontend.php        |  4 +--
 .../install/Resources/Private/Php/install.php |  4 +--
 7 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh
index 6219fbef9004..a2662681adb9 100755
--- a/Build/Scripts/runTests.sh
+++ b/Build/Scripts/runTests.sh
@@ -49,7 +49,7 @@ Successfully tested with docker version 18.06.1-ce and docker-compose 1.21.2.
 
 Usage: $0 [options] [file]
 
-No arguments: Run all unit tests with PHP 7.2
+No arguments: Run all unit tests with PHP 7.4
 
 Options:
     -a <mysqli|pdo_mysql|sqlsrv|pdo_sqlsrv>
@@ -136,11 +136,9 @@ Options:
             - 12
              -13
 
-    -p <7.2|7.3|7.4|8.0>
+    -p <7.4|8.0>
         Specifies the PHP minor version to be used
-            - 7.2 (default): use PHP 7.2
-            - 7.3: use PHP 7.3
-            - 7.4: use PHP 7.4
+            - 7.4 (default): use PHP 7.4
             - 8.0: use PHP 8.0
 
     -e "<phpunit or codeception options>"
@@ -183,25 +181,25 @@ Options:
         Show this help.
 
 Examples:
-    # Run all core unit tests using PHP 7.2
+    # Run all core unit tests using PHP 7.4
     ./Build/Scripts/runTests.sh
     ./Build/Scripts/runTests.sh -s unit
 
     # Run all core units tests and enable xdebug (have a PhpStorm listening on port 9000!)
     ./Build/Scripts/runTests.sh -x
 
-    # Run unit tests in phpunit verbose mode with xdebug on PHP 7.3 and filter for test canRetrieveValueWithGP
-    ./Build/Scripts/runTests.sh -x -p 7.3 -e "-v --filter canRetrieveValueWithGP"
+    # Run unit tests in phpunit verbose mode with xdebug on PHP 8.0 and filter for test canRetrieveValueWithGP
+    ./Build/Scripts/runTests.sh -x -p 8.0 -e "-v --filter canRetrieveValueWithGP"
 
     # Run functional tests in phpunit with a filtered test method name in a specified file
     # example will currently execute two tests, both of which start with the search term
     ./Build/Scripts/runTests.sh -s functional -e "--filter deleteContent" typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/ActionTest.php
 
-    # Run unit tests with PHP 7.3 and have xdebug enabled
-    ./Build/Scripts/runTests.sh -x -p 7.3
+    # Run unit tests with PHP 8.0 and have xdebug enabled
+    ./Build/Scripts/runTests.sh -x -p 8.0
 
-    # Run functional tests on postgres with xdebug, php 7.3 and execute a restricted set of tests
-    ./Build/Scripts/runTests.sh -x -p 7.3 -s functional -d postgres typo3/sysext/core/Tests/Functional/Authentication
+    # Run functional tests on postgres with xdebug, php 8.0 and execute a restricted set of tests
+    ./Build/Scripts/runTests.sh -x -p 8.0 -s functional -d postgres typo3/sysext/core/Tests/Functional/Authentication
 
     # Run functional tests on mariadb 10.5
     ./Build/Scripts/runTests.sh -d mariadb -i 10.5
@@ -237,7 +235,7 @@ cd ../testing-docker/local || exit 1
 CORE_ROOT="${PWD}/../../../"
 TEST_SUITE="unit"
 DBMS="mariadb"
-PHP_VERSION="7.2"
+PHP_VERSION="7.4"
 PHP_XDEBUG_ON=0
 PHP_XDEBUG_PORT=9000
 EXTRA_TEST_OPTIONS=""
@@ -286,7 +284,7 @@ while getopts ":a:s:d:i:j:k:p:e:xy:o:nhuv" OPT; do
             ;;
         p)
             PHP_VERSION=${OPTARG}
-            if ! [[ ${PHP_VERSION} =~ ^(7.2|7.3|7.4|8.0)$ ]]; then
+            if ! [[ ${PHP_VERSION} =~ ^(7.4|8.0)$ ]]; then
                 INVALID_OPTIONS+=(${OPTARG})
             fi
             ;;
@@ -335,7 +333,7 @@ if [ ${#INVALID_OPTIONS[@]} -ne 0 ]; then
     exit 1
 fi
 
-# Move "7.2" to "php72", the latter is the docker container name
+# Move "7.4" to "php74", the latter is the docker container name
 DOCKER_PHP_IMAGE=`echo "php${PHP_VERSION}" | sed -e 's/\.//'`
 
 # Set $1 to first mass argument, this is the optional test file or test directory to execute
diff --git a/composer.json b/composer.json
index 10cfa669a7a1..6e66330fbfc9 100644
--- a/composer.json
+++ b/composer.json
@@ -26,12 +26,12 @@
 	"config": {
 		"bin-dir": "bin",
 		"platform": {
-			"php": "7.2.5"
+			"php": "7.4.1"
 		},
 		"sort-packages": true
 	},
 	"require": {
-		"php": "^7.2",
+		"php": "^7.4",
 		"ext-PDO": "*",
 		"ext-json": "*",
 		"ext-libxml": "*",
diff --git a/composer.lock b/composer.lock
index 2382ebdadd1f..d1765264712b 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": "445e3ab9b036557e6e8221ae41d3655e",
+    "content-hash": "40d308bc780250e0c76a8112f435c887",
     "packages": [
         {
             "name": "cogpowered/finediff",
@@ -8208,7 +8208,7 @@
     "prefer-stable": false,
     "prefer-lowest": false,
     "platform": {
-        "php": "^7.2",
+        "php": "^7.4",
         "ext-pdo": "*",
         "ext-json": "*",
         "ext-libxml": "*",
@@ -8220,7 +8220,7 @@
         "composer-runtime-api": "^2.0"
     },
     "platform-overrides": {
-        "php": "7.2.5"
+        "php": "7.4.1"
     },
     "plugin-api-version": "2.0.0"
 }
diff --git a/typo3/sysext/backend/Resources/Private/Php/backend.php b/typo3/sysext/backend/Resources/Private/Php/backend.php
index 68b300f97c29..68b4dfada7c3 100644
--- a/typo3/sysext/backend/Resources/Private/Php/backend.php
+++ b/typo3/sysext/backend/Resources/Private/Php/backend.php
@@ -14,8 +14,8 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (PHP_VERSION_ID < 70200) {
-    die('This version of TYPO3 CMS requires PHP 7.2 or above');
+if (PHP_VERSION_ID < 70400) {
+    die('This version of TYPO3 CMS requires PHP 7.4 or above');
 }
 
 // Set up the application for the backend
diff --git a/typo3/sysext/core/composer.json b/typo3/sysext/core/composer.json
index a2174eb7a62c..83fea208287b 100644
--- a/typo3/sysext/core/composer.json
+++ b/typo3/sysext/core/composer.json
@@ -19,7 +19,7 @@
 		"sort-packages": true
 	},
 	"require": {
-		"php": "^7.2",
+		"php": "^7.4",
 		"ext-PDO": "*",
 		"ext-json": "*",
 		"ext-libxml": "*",
diff --git a/typo3/sysext/frontend/Resources/Private/Php/frontend.php b/typo3/sysext/frontend/Resources/Private/Php/frontend.php
index 1e49d8e86dd6..774e5cf207f6 100644
--- a/typo3/sysext/frontend/Resources/Private/Php/frontend.php
+++ b/typo3/sysext/frontend/Resources/Private/Php/frontend.php
@@ -14,8 +14,8 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (PHP_VERSION_ID < 70200) {
-    die('This version of TYPO3 CMS requires PHP 7.2 or above');
+if (PHP_VERSION_ID < 70400) {
+    die('This version of TYPO3 CMS requires PHP 7.4 or above');
 }
 
 // Set up the application for the frontend
diff --git a/typo3/sysext/install/Resources/Private/Php/install.php b/typo3/sysext/install/Resources/Private/Php/install.php
index dc962f5942ce..af19d16e4bea 100644
--- a/typo3/sysext/install/Resources/Private/Php/install.php
+++ b/typo3/sysext/install/Resources/Private/Php/install.php
@@ -95,8 +95,8 @@
  */
 
 // Exit early if php requirement is not satisfied.
-if (PHP_VERSION_ID < 70200) {
-    die('This version of TYPO3 CMS requires PHP 7.2 or above');
+if (PHP_VERSION_ID < 70400) {
+    die('This version of TYPO3 CMS requires PHP 7.4 or above');
 }
 
 call_user_func(function () {
-- 
GitLab