From e67853b5c4b2afa0f68675e3d2f7360f60669392 Mon Sep 17 00:00:00 2001 From: Helmut Hummel <typo3@helhum.io> Date: Mon, 27 Apr 2020 23:47:06 +0200 Subject: [PATCH] [TASK] Remove dead and outdated check for TYPO3_PATH_WEB constant The check for the constant TYPO3_PATH_WEB was an experiment, to allow a document root with public assets only, but this never worked out and was never really used. The check can safely be removed, as it won't do anything useful anyway. Also adapt a comment in SystemEnvironmentBuilder which still refers to this variable/constant and its usage in the helhum/typo3-secure-web package. This statement can be removed as helhum/typo3-secure-web is not actually using that constant/envvar. Resolves: #91215 Related: #63025 Releases: master Change-Id: I1b44ba97f4654d1e4e200d7ad1a7c228dba48c25 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64330 Tested-by: Benjamin Franzke <bfr@qbus.de> Tested-by: Josef Glatz <josefglatz@gmail.com> Tested-by: Benni Mack <benni@typo3.org> Tested-by: TYPO3com <noreply@typo3.com> Reviewed-by: Benjamin Franzke <bfr@qbus.de> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Josef Glatz <josefglatz@gmail.com> --- .../core/Classes/Core/SystemEnvironmentBuilder.php | 13 ++++++++----- typo3/sysext/core/Classes/Http/NormalizedParams.php | 13 ++++--------- .../sysext/core/Classes/Utility/GeneralUtility.php | 7 ++----- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php index e1b3ad9cfe51..d4a48c49e92f 100644 --- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php +++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php @@ -179,11 +179,14 @@ class SystemEnvironmentBuilder } /** - * Absolute path to the root of the typo3 instance. This is often identical to the web document root path (eg. .../public), - * but may be different. For instance helhum/typo3-secure-web uses this: Then, rootPath TYPO3_PATH_ROOT is the absolute path to - * the private directory where code and runtime files are located (currently typo3/ext, typo3/sysext, fileadmin, typo3temp), - * while TYPO3_PATH_WEB is the public/ web document folder that gets assets like fileadmin and Resources/Public folders - * from extensions linked in. + * Absolute path to the "classic" site root of the TYPO3 application. + * This semantically refers to the directory where executable server-side code, configuration + * and runtime files are located (e.g. typo3conf/ext, typo3/sysext, typo3temp/var). + * In practice this is always identical to the public web document root path which contains + * files that are served by the webserver directly (fileadmin/ and public resources). + * + * This is not to be confused with the app-path that is used in composer-mode installations (by default). + * Resources in app-path are located outside the document root. * * @param int $entryPointLevel Number of subdirectories where the entry script is located under the document root * @param int $requestType diff --git a/typo3/sysext/core/Classes/Http/NormalizedParams.php b/typo3/sysext/core/Classes/Http/NormalizedParams.php index d1db0f3a246f..f2911395aa8f 100644 --- a/typo3/sysext/core/Classes/Http/NormalizedParams.php +++ b/typo3/sysext/core/Classes/Http/NormalizedParams.php @@ -819,15 +819,10 @@ class NormalizedParams */ protected static function determineSiteUrl(string $requestDir, string $pathThisScript, string $pathSite): string { - if (defined('TYPO3_PATH_WEB')) { - // This can only be set by external entry scripts - $siteUrl = $requestDir; - } else { - $pathThisScriptDir = substr(dirname($pathThisScript), strlen($pathSite)) . '/'; - $siteUrl = substr($requestDir, 0, -strlen($pathThisScriptDir)); - $siteUrl = rtrim($siteUrl, '/') . '/'; - } - return $siteUrl; + $pathThisScriptDir = substr(dirname($pathThisScript), strlen($pathSite)) . '/'; + $siteUrl = substr($requestDir, 0, -strlen($pathThisScriptDir)); + + return rtrim($siteUrl, '/') . '/'; } /** diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 34f2f633ad7a..cf1a297da5c8 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2777,12 +2777,9 @@ class GeneralUtility $retVal = self::getIndpEnv('TYPO3_REQUEST_HOST') . self::dirname(self::getIndpEnv('SCRIPT_NAME')) . '/'; break; case 'TYPO3_SITE_URL': - $url = self::getIndpEnv('TYPO3_REQUEST_DIR'); - // This can only be set by external entry scripts - if (defined('TYPO3_PATH_WEB')) { - $retVal = $url; - } elseif (Environment::getCurrentScript()) { + if (Environment::getCurrentScript()) { $lPath = PathUtility::stripPathSitePrefix(PathUtility::dirnameDuringBootstrap(Environment::getCurrentScript())) . '/'; + $url = self::getIndpEnv('TYPO3_REQUEST_DIR'); $siteUrl = substr($url, 0, -strlen($lPath)); if (substr($siteUrl, -1) !== '/') { $siteUrl .= '/'; -- GitLab