diff --git a/typo3/sysext/core/Classes/Charset/CharsetConverter.php b/typo3/sysext/core/Classes/Charset/CharsetConverter.php index e77a1dae1136bdaa8784a944786c511e5c73a7da..59455db045019b03ff7022ac0314b4d66af63b55 100644 --- a/typo3/sysext/core/Classes/Charset/CharsetConverter.php +++ b/typo3/sysext/core/Classes/Charset/CharsetConverter.php @@ -451,6 +451,10 @@ class CharsetConverter implements SingletonInterface } elseif ($detectedType === 'whitespaced') { $regA = []; preg_match('/[[:space:]]*0x([[:xdigit:]]*)[[:space:]]+0x([[:xdigit:]]*)[[:space:]]+/', $value, $regA); + if (empty($regA)) { + // No match => skip this item + continue; + } $hexbyte = $regA[1]; $utf8 = 'U+' . $regA[2]; } diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index 4d9cf9cff5749baecfdd8e95c3b0d717921cde76..655ee4fb4b4bfc86c15e8db0a9031e593d4d6c0e 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -366,6 +366,7 @@ class Bootstrap */ protected static function initializeErrorHandling() { + static::initializeBasicErrorReporting(); $displayErrors = 0; $exceptionHandlerClassName = null; $productionExceptionHandlerClassName = $GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler']; @@ -416,6 +417,25 @@ class Bootstrap } } + /** + * Initialize basic error reporting. + * + * There are a lot of extensions that have no strict / notice / deprecated free + * ext_localconf or ext_tables. Since the final error reporting must be set up + * after those extension files are read, a default configuration is needed to + * suppress error reporting meanwhile during further bootstrap. + * + * Please note: if you comment out this code, TYPO3 would never set any error reporting + * which would need to have TYPO3 Core and ALL used extensions to be notice free and deprecation + * free. However, commenting this out and running functional and acceptance tests shows what + * needs to be done to make TYPO3 Core mostly notice-free (unit tests do not execute this code here). + */ + protected static function initializeBasicErrorReporting(): void + { + // Core should be notice free at least until this point ... + error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); + } + /** * Initializes IO and stream wrapper related behavior. */ diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php index ddc84c90dcbbb2d87177fe333e76ea6fbf9e920c..df27ff4b58b51fe5876dd07554dd7ad680bceb5c 100644 --- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php +++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php @@ -83,7 +83,6 @@ class SystemEnvironmentBuilder self::initializeGlobalVariables(); self::initializeGlobalTimeTrackingVariables(); - self::initializeBasicErrorReporting(); self::initializeEnvironment($requestType, $scriptPath, $rootPath); } @@ -264,20 +263,6 @@ class SystemEnvironmentBuilder ); } - /** - * Initialize basic error reporting. - * - * There are a lot of extensions that have no strict / notice / deprecated free - * ext_localconf or ext_tables. Since the final error reporting must be set up - * after those extension files are read, a default configuration is needed to - * suppress error reporting meanwhile during further bootstrap. - */ - protected static function initializeBasicErrorReporting() - { - // Core should be notice free at least until this point ... - error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); - } - /** * Determine if the operating system TYPO3 is running on is windows. */ diff --git a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php index 1ea6bc0ca22b084451583d9a3ce9917e7096ae18..10fb021ee9dd34e4d2b2d4949d0d686a62abc718 100644 --- a/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php +++ b/typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php @@ -45,7 +45,7 @@ class SystemEnvironmentBuilderTest extends UnitTestCase { $fileName = StringUtility::getUniqueId('filename'); $data = []; - $phpExtensions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', 'php,php3,php4,php5,php6,phpsh,phtml,pht', true); + $phpExtensions = ['php', 'php3', 'php4', 'php5', 'php7', 'phpsh', 'phtml', 'pht']; foreach ($phpExtensions as $extension) { $data[] = [$fileName . '.' . $extension]; $data[] = [$fileName . '.' . $extension . '.txt']; @@ -163,40 +163,4 @@ class SystemEnvironmentBuilderTest extends UnitTestCase $this->subject->_call('initializeGlobalTimeTrackingVariables'); self::assertEquals(0, $GLOBALS['SIM_ACCESS_TIME'] % 60); } - - /** - * @test - */ - public function initializeBasicErrorReportingExcludesStrict() - { - $backupReporting = error_reporting(); - $this->subject->_call('initializeBasicErrorReporting'); - $actualReporting = error_reporting(); - error_reporting($backupReporting); - self::assertEquals(0, $actualReporting & E_STRICT); - } - - /** - * @test - */ - public function initializeBasicErrorReportingExcludesNotice() - { - $backupReporting = error_reporting(); - $this->subject->_call('initializeBasicErrorReporting'); - $actualReporting = error_reporting(); - error_reporting($backupReporting); - self::assertEquals(0, $actualReporting & E_NOTICE); - } - - /** - * @test - */ - public function initializeBasicErrorReportingExcludesDeprecated() - { - $backupReporting = error_reporting(); - $this->subject->_call('initializeBasicErrorReporting'); - $actualReporting = error_reporting(); - error_reporting($backupReporting); - self::assertEquals(0, $actualReporting & E_DEPRECATED); - } }