diff --git a/typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php b/typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
index 42cc2885f2ca988a9cf8d863e67c2e5e74104a12..bd8969edff714a95dc1303273237ed53a26a652b 100644
--- a/typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
+++ b/typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
@@ -85,7 +85,7 @@ class ClassLoadingInformationGenerator
                 foreach ($autoloadPsr4 as $namespacePrefix => $paths) {
                     foreach ((array)$paths as $path) {
                         $namespacePath = $packagePath . $path;
-                        $namespaceRealPath = realpath($namespacePath);
+                        $namespaceRealPath = (string)realpath($namespacePath);
                         if ($useRelativePaths) {
                             $psr4[$namespacePrefix][] = $this->makePathRelative($namespacePath, $namespaceRealPath);
                         } else {
@@ -115,18 +115,18 @@ class ClassLoadingInformationGenerator
      *
      * @param \stdClass $manifest
      * @param string $section
-     * @return array
+     * @return array<string,array>
      */
     protected function getAutoloadSectionFromManifest($manifest, $section)
     {
         $finalAutoloadSection = [];
-        $autoloadDefinition = json_decode(json_encode($manifest->autoload), true);
+        $autoloadDefinition = json_decode((string)json_encode($manifest->autoload), true);
         if (!empty($autoloadDefinition[$section]) && is_array($autoloadDefinition[$section])) {
             $finalAutoloadSection = $autoloadDefinition[$section];
         }
         if ($this->isDevMode) {
             if (isset($manifest->{'autoload-dev'})) {
-                $autoloadDefinitionDev = json_decode(json_encode($manifest->{'autoload-dev'}), true);
+                $autoloadDefinitionDev = json_decode((string)json_encode($manifest->{'autoload-dev'}), true);
                 if (!empty($autoloadDefinitionDev[$section]) && is_array($autoloadDefinitionDev[$section])) {
                     $finalAutoloadSection = array_merge($finalAutoloadSection, $autoloadDefinitionDev[$section]);
                 }
@@ -150,7 +150,7 @@ class ClassLoadingInformationGenerator
         $classMap = [];
         $blacklistExpression = null;
         if ($ignorePotentialTestClasses) {
-            $blacklistPathPrefix = realpath($classesPath);
+            $blacklistPathPrefix = (string)realpath($classesPath);
             $blacklistPathPrefix = str_replace('\\', '/', $blacklistPathPrefix);
             $blacklistExpression = "{($blacklistPathPrefix/tests/|$blacklistPathPrefix/Tests/|$blacklistPathPrefix/Resources/|$blacklistPathPrefix/res/|$blacklistPathPrefix/class.ext_update.php)}";
         }
@@ -255,7 +255,7 @@ EOF;
     protected function makePathRelative($packagePath, $realPathOfClassFile, $relativeToRoot = true)
     {
         $realPathOfClassFile = GeneralUtility::fixWindowsFilePath($realPathOfClassFile);
-        $packageRealPath = GeneralUtility::fixWindowsFilePath(realpath($packagePath));
+        $packageRealPath = GeneralUtility::fixWindowsFilePath((string)realpath($packagePath));
         $relativePackagePath = rtrim(substr($packagePath, strlen($this->installationRoot)), '/');
         if ($relativeToRoot) {
             if ($realPathOfClassFile === $packageRealPath) {
diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
index 4862b7e536ff4621f8edb00402b9592117094191..80171952b59558a4c2008af427c0311c58d10a5a 100644
--- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
+++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
@@ -131,7 +131,7 @@ class SystemEnvironmentBuilder
                 // or has the real path
                 $scriptName = ltrim(substr($scriptPath, strlen($rootPath)), '/');
             }
-            $rootPath = rtrim(GeneralUtility::fixWindowsFilePath(getenv('TYPO3_PATH_ROOT')), '/');
+            $rootPath = rtrim(GeneralUtility::fixWindowsFilePath((string)getenv('TYPO3_PATH_ROOT')), '/');
             $scriptPath = $rootPath . '/' . $scriptName;
         }
         return $scriptPath;
@@ -155,7 +155,7 @@ class SystemEnvironmentBuilder
     {
         // Check if the root path has been set in the environment (e.g. by the composer installer)
         if (getenv('TYPO3_PATH_ROOT')) {
-            return rtrim(GeneralUtility::fixWindowsFilePath(getenv('TYPO3_PATH_ROOT')), '/');
+            return rtrim(GeneralUtility::fixWindowsFilePath((string)getenv('TYPO3_PATH_ROOT')), '/');
         }
         $isCli = self::isCliRequestType($requestType);
         // Absolute path of the entry script that was called
@@ -199,7 +199,7 @@ class SystemEnvironmentBuilder
     protected static function initializeEnvironment(int $requestType, string $scriptPath, string $sitePath)
     {
         if (getenv('TYPO3_PATH_ROOT')) {
-            $rootPathFromEnvironment = rtrim(GeneralUtility::fixWindowsFilePath(getenv('TYPO3_PATH_ROOT')), '/');
+            $rootPathFromEnvironment = rtrim(GeneralUtility::fixWindowsFilePath((string)getenv('TYPO3_PATH_ROOT')), '/');
             if ($sitePath !== $rootPathFromEnvironment) {
                 // This means, that we re-initialized the environment during a single request
                 // This currently only happens in custom code or during functional testing
@@ -209,7 +209,7 @@ class SystemEnvironmentBuilder
             }
         }
 
-        $projectRootPath = GeneralUtility::fixWindowsFilePath(getenv('TYPO3_PATH_APP'));
+        $projectRootPath = GeneralUtility::fixWindowsFilePath((string)getenv('TYPO3_PATH_APP'));
         $isDifferentRootPath = ($projectRootPath && $projectRootPath !== $sitePath);
         Environment::initialize(
             static::createApplicationContext(),