From 20182ea16b005eb67759f4adcdc3e1dcba530a04 Mon Sep 17 00:00:00 2001 From: Christian Kuhn <lolli@schwarzbu.ch> Date: Sun, 3 Dec 2017 20:48:21 +0100 Subject: [PATCH] [BUGFIX] Unit tests: Define TYPO3_REQUESTTYPE Unit test boostrap does not initialize constants TYPO3_REQUESTTYPE and TYPO3_REQUESTTYPE_*, but various tests rely on this basic constants being properly defined in core v7. With PHP 7.2, accessing undefined connstants throws warnings. Patch makes according bootstrap method public and calls it during unit test bootstrap. Change-Id: I450e440694385244c554adef00a9c74135d457f5 Resolves: #83211 Releases: 7.6 Reviewed-on: https://review.typo3.org/54925 Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: TYPO3com <no-reply@typo3.com> --- typo3/sysext/core/Build/UnitTestsBootstrap.php | 4 ++++ typo3/sysext/core/Classes/Core/Bootstrap.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/core/Build/UnitTestsBootstrap.php b/typo3/sysext/core/Build/UnitTestsBootstrap.php index 4ec5fe42c89c..bfebaa8fcc47 100644 --- a/typo3/sysext/core/Build/UnitTestsBootstrap.php +++ b/typo3/sysext/core/Build/UnitTestsBootstrap.php @@ -134,6 +134,10 @@ class UnitTestsBootstrap define('TYPO3_cliMode', true); putenv('TYPO3_CONTEXT=Testing'); + // Set TYPO3_AJAX and define TYPO3_REQUESSTTYPE's to prevent PHP 7.2 warnings + $GLOBALS['TYPO3_AJAX'] = ''; + Bootstrap::getInstance()->defineTypo3RequestTypes(); + return $this; } diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 145644fc864f..91b28c44feb7 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -738,7 +738,7 @@ class Bootstrap * * @return Bootstrap */ - protected function defineTypo3RequestTypes() + public function defineTypo3RequestTypes() { define('TYPO3_REQUESTTYPE_FE', 1); define('TYPO3_REQUESTTYPE_BE', 2); -- GitLab