[FEATURE] PHP 8.0 support
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 14 Jun 2021 13:09:59 +0000 (15:09 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 14 Jun 2021 14:34:44 +0000 (16:34 +0200)
After a long way of fixing our code base to have
all our tests (unit, functional, acceptance tests)
green, TYPO3 now officially runs with PHP 8.0.

TYPO3 v11 LTS thus will support PHP 7.4 and PHP 8.0
(and hopefully PHP 8.1 once the dependencies support PHP 8.1).

There might be a few PHP notices throughout TYPO3 Frontend
and Backend, but all base functionality is now available
for PHP 8.0 as well.

Resolves: #93631
Related: #94057
Releases: master
Change-Id: I5798e6f49ee637b794df096fd44b8157d96b74bc
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69489
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/gitlab-ci/nightly/acceptance-backend.yml
Build/gitlab-ci/nightly/acceptance-install.yml
Build/gitlab-ci/pre-merge/acceptance-backend.yml
Build/gitlab-ci/pre-merge/acceptance-install.yml
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php
typo3/sysext/backend/Classes/Provider/PageTsBackendLayoutDataProvider.php
typo3/sysext/core/Documentation/Changelog/master/Feature-93631-SupportForPHP80.rst [new file with mode: 0644]
typo3/sysext/form/Classes/Mvc/Persistence/FormPersistenceManager.php

index e65cde1..62a8660 100644 (file)
@@ -42,3 +42,48 @@ acceptance backend mariadb php 7.4 min:
   script:
     - Build/Scripts/runTests.sh -s composerInstallMin -p 7.4
     - Build/Scripts/runTests.sh -s acceptance -d mariadb -i 10.3 -p 7.4 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
+
+acceptance backend mariadb php 8.0 locked:
+  stage: acceptance
+  only:
+    - schedules
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  parallel: 8
+  script:
+      - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+      - Build/Scripts/runTests.sh -s acceptance -d mariadb -i 10.3 -p 8.0 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
+acceptance backend mariadb php 8.0 max:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-max
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  parallel: 8
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMax -p 8.0
+    - Build/Scripts/runTests.sh -s acceptance -d mariadb -i 10.3 -p 8.0 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
+acceptance backend mariadb php 8.0 min:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-min
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  parallel: 8
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMin -p 8.0
+    - Build/Scripts/runTests.sh -s acceptance -d mariadb -i 10.3 -p 8.0 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
index 757c519..edd4c1f 100644 (file)
@@ -40,6 +40,48 @@ acceptance install mariadb php 7.4 min:
     - Build/Scripts/runTests.sh -s composerInstallMin -p 7.4
     - Build/Scripts/runTests.sh -s install -d mariadb -i 10.3 -p 7.4
 
+acceptance install mariadb php 8.0 locked:
+  stage: acceptance
+  only:
+    - schedules
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mariadb -i 10.3 -p 8.0
+acceptance install mariadb php 8.0 max:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-max
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMax -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mariadb -i 10.3 -p 8.0
+acceptance install mariadb php 8.0 min:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-min
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMin -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mariadb -i 10.3 -p 8.0
+
 acceptance install mysql php 7.4:
   stage: acceptance
   only:
@@ -82,6 +124,48 @@ acceptance install mysql php 7.4 min:
     - Build/Scripts/runTests.sh -s composerInstallMin -p 7.4
     - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 7.4
 
+acceptance install mysql php 8.0:
+  stage: acceptance
+  only:
+    - schedules
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 8.0
+acceptance install mysql php 8.0 max:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-max
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMax -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 8.0
+acceptance install mysql php 8.0 min:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-min
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMin -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 8.0
+
 acceptance install postgres php 7.4 locked:
   stage: acceptance
   only:
@@ -124,6 +208,48 @@ acceptance install postgres php 7.4 min:
     - Build/Scripts/runTests.sh -s composerInstallMin -p 7.4
     - Build/Scripts/runTests.sh -s install -d postgres -k 10 -p 7.4
 
+acceptance install postgres php 8.0 locked:
+  stage: acceptance
+  only:
+    - schedules
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d postgres -k 10 -p 8.0
+acceptance install postgres php 8.0 max:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-max
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMax -p 8.0
+    - Build/Scripts/runTests.sh -s install -d postgres -k 10 -p 8.0
+acceptance install postgres php 8.0 min:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-min
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMin -p 8.0
+    - Build/Scripts/runTests.sh -s install -d postgres -k 10 -p 8.0
+
 acceptance install sqlite php 7.4 locked:
   stage: acceptance
   only:
@@ -165,3 +291,45 @@ acceptance install sqlite php 7.4 min:
   script:
     - Build/Scripts/runTests.sh -s composerInstallMin -p 7.4
     - Build/Scripts/runTests.sh -s install -d sqlite -p 7.4
+
+acceptance install sqlite php 8.0 locked:
+  stage: acceptance
+  only:
+    - schedules
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d sqlite -p 8.0
+acceptance install sqlite php 8.0 max:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-max
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMax -p 8.0
+    - Build/Scripts/runTests.sh -s install -d sqlite -p 8.0
+acceptance install sqlite php 8.0 min:
+  stage: acceptance
+  only:
+    - schedules
+  cache:
+    key: master-composer-min
+    paths:
+      - .cache
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  script:
+    - Build/Scripts/runTests.sh -s composerInstallMin -p 8.0
+    - Build/Scripts/runTests.sh -s install -d sqlite -p 8.0
index 3eccb7f..c0b96b8 100644 (file)
@@ -12,3 +12,18 @@ acceptance backend mariadb php 7.4 pre-merge:
   script:
     - Build/Scripts/runTests.sh -s composerInstall -p 7.4
     - Build/Scripts/runTests.sh -s acceptance -p 7.4 -d mariadb -i 10.3 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
+
+acceptance backend mariadb php 8.0 pre-merge:
+  stage: main
+  except:
+    refs:
+      - schedules
+      - master
+  artifacts:
+    when: on_failure
+    paths:
+      - typo3temp/var/tests/AcceptanceReports
+  parallel: 10
+  script:
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s acceptance -p 8.0 -d mariadb -i 10.3 -c $CI_NODE_INDEX/$CI_NODE_TOTAL
index 554523e..5ab0098 100644 (file)
@@ -12,7 +12,7 @@ acceptance install mariadb php 7.4 pre-merge:
     - Build/Scripts/runTests.sh -s composerInstall -p 7.4
     - Build/Scripts/runTests.sh -s install -d mariadb -i 10.3 -p 7.4
 
-acceptance install mysql php 7.4 pre-merge:
+acceptance install mysql php 8.0 pre-merge:
   stage: main
   except:
     refs:
@@ -23,8 +23,8 @@ acceptance install mysql php 7.4 pre-merge:
     paths:
       - typo3temp/var/tests/AcceptanceReports
   script:
-    - Build/Scripts/runTests.sh -s composerInstall -p 7.4
-    - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 7.4
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d mysql -j 5.5 -p 8.0
 
 acceptance install postgres php 7.4 pre-merge:
   stage: main
@@ -40,7 +40,7 @@ acceptance install postgres php 7.4 pre-merge:
     - Build/Scripts/runTests.sh -s composerInstall -p 7.4
     - Build/Scripts/runTests.sh -s install -d postgres -k 10 -p 7.4
 
-acceptance install sqlite php 7.4 pre-merge:
+acceptance install sqlite php 8.0 pre-merge:
   stage: main
   except:
     refs:
@@ -51,5 +51,5 @@ acceptance install sqlite php 7.4 pre-merge:
     paths:
       - typo3temp/var/tests/AcceptanceReports
   script:
-    - Build/Scripts/runTests.sh -s composerInstall -p 7.4
-    - Build/Scripts/runTests.sh -s install -d sqlite -p 7.4
+    - Build/Scripts/runTests.sh -s composerInstall -p 8.0
+    - Build/Scripts/runTests.sh -s install -d sqlite -p 8.0
index dc15ae5..4cd55c9 100644 (file)
@@ -364,7 +364,7 @@ class ElementInformationController
                 continue;
             }
 
-            $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
+            $isExcluded = !(!($GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] ?? false) || $this->getBackendUser()->check('non_exclude_fields', $this->table . ':' . $name));
             if ($isExcluded) {
                 continue;
             }
@@ -426,7 +426,7 @@ class ElementInformationController
                             continue;
                         }
 
-                        $isExcluded = !(!$GLOBALS['TCA'][$table]['columns'][$name]['exclude'] || $this->getBackendUser()->check('non_exclude_fields', $table . ':' . $name));
+                        $isExcluded = !(!($GLOBALS['TCA'][$table]['columns'][$name]['exclude'] ?? false) || $this->getBackendUser()->check('non_exclude_fields', $table . ':' . $name));
                         if ($isExcluded) {
                             continue;
                         }
@@ -468,7 +468,7 @@ class ElementInformationController
 
             $ctrlKeysOfUnneededFields = ['origUid', 'transOrigPointerField', 'transOrigDiffSourceField'];
             foreach ($ctrlKeysOfUnneededFields as $field) {
-                if (($key = array_search($GLOBALS['TCA'][$table]['ctrl'][$field], $fieldList, true)) !== false) {
+                if (isset($GLOBALS['TCA'][$table]['ctrl'][$field]) && ($key = array_search($GLOBALS['TCA'][$table]['ctrl'][$field], $fieldList, true)) !== false) {
                     unset($fieldList[$key]);
                 }
             }
@@ -578,7 +578,7 @@ class ElementInformationController
      */
     protected function getLabelForTableColumn($tableName, $fieldName): string
     {
-        if ($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label'] !== null) {
+        if (($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label'] ?? null) !== null) {
             $field = $this->getLanguageService()->sL($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label']);
             if (trim($field) === '') {
                 $field = $fieldName;
index d70c015..2191574 100644 (file)
@@ -175,10 +175,10 @@ class PageTsBackendLayoutDataProvider implements DataProviderInterface
         $backendLayout = [];
         if (!empty($data['config.']['backend_layout.']) && is_array($data['config.']['backend_layout.'])) {
             $backendLayout['uid'] = substr($identifier, 0, -1);
-            $backendLayout['title'] = $data['title'] ?: $backendLayout['uid'];
-            $backendLayout['icon'] = $data['icon'] ?: '';
+            $backendLayout['title'] = $data['title'] ?? $backendLayout['uid'];
+            $backendLayout['icon'] = $data['icon'] ?? '';
             // Convert PHP array back to plain TypoScript so it can be processed
-            $config = ArrayUtility::flatten($data['config.']);
+            $config = ArrayUtility::flatten($data['config.'] ?? []);
             $backendLayout['config'] = '';
             foreach ($config as $row => $value) {
                 $backendLayout['config'] .= $row . ' = ' . $value . "\r\n";
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-93631-SupportForPHP80.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-93631-SupportForPHP80.rst
new file mode 100644 (file)
index 0000000..c4f291a
--- /dev/null
@@ -0,0 +1,20 @@
+.. include:: ../../Includes.txt
+
+=====================================
+Feature: #93631 - Support for PHP 8.0
+=====================================
+
+See :issue:`93631`
+
+Description
+===========
+
+TYPO3 Core is now compatible with PHP 8.0, which is officially supported with security updates until 26th November 2023.
+
+
+Impact
+======
+
+TYPO3 can now be installed on systems running with PHP 8.0.
+
+.. index:: PHP-API, ext:core
\ No newline at end of file
index 7b75c24..8a675f6 100644 (file)
@@ -247,9 +247,12 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
                     'removable' => true,
                     'location' => 'storage',
                     'duplicateIdentifier' => false,
-                    'invalid' => $form['invalid'],
-                    'fileUid' => $form['fileUid'],
+                    'invalid' => $form['invalid'] ?? false,
+                    'fileUid' => $form['fileUid'] ?? 0,
                 ];
+                if (!isset($identifiers[$form['identifier']])) {
+                    $identifiers[$form['identifier']] = 0;
+                }
                 $identifiers[$form['identifier']]++;
             }
         }
@@ -267,9 +270,12 @@ class FormPersistenceManager implements FormPersistenceManagerInterface
                         'removable' => $this->formSettings['persistenceManager']['allowDeleteFromExtensionPaths'] ? true: false,
                         'location' => 'extension',
                         'duplicateIdentifier' => false,
-                        'invalid' => $form['invalid'],
-                        'fileUid' => $form['fileUid'],
+                        'invalid' => $form['invalid'] ?? false,
+                        'fileUid' => $form['fileUid'] ?? 0,
                     ];
+                    if (!isset($identifiers[$form['identifier']])) {
+                        $identifiers[$form['identifier']] = 0;
+                    }
                     $identifiers[$form['identifier']]++;
                 }
             }