From 86f23d90b45f7ec54e9d3cecbe8b3a97f494dda5 Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Thu, 20 Dec 2018 19:09:34 +0100 Subject: [PATCH 1/1] [!!!][TASK] Remove deprecated global constants Drops most global constants marked for removal, only PATH_site and PATH_thisScript are left, those need special care. Resolves: #87247 Releases: master Change-Id: Id93f31df8abb44d9f4f1df836b49ff225741fb83 Reviewed-on: https://review.typo3.org/59244 Tested-by: TYPO3com Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters Reviewed-by: Anja Leichsenring Tested-by: Anja Leichsenring --- .../Classes/Core/SystemEnvironmentBuilder.php | 77 +++---------------- .../Classes/Error/DebugExceptionHandler.php | 2 +- ...g-87193-DeprecatedFunctionalityRemoved.rst | 25 ++++++ .../ExtensionScanner/Php/ConstantMatcher.php | 24 ++++++ 4 files changed, 59 insertions(+), 69 deletions(-) diff --git a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php index 3144681bac83..8b73939f961f 100644 --- a/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php +++ b/typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php @@ -87,7 +87,6 @@ class SystemEnvironmentBuilder self::setRequestType($requestType | ($requestType === self::REQUESTTYPE_BE && strpos($_REQUEST['route'] ?? '', '/ajax/') === 0 ? TYPO3_REQUESTTYPE_AJAX : 0)); self::defineLegacyConstants($requestType === self::REQUESTTYPE_FE ? 'FE' : 'BE'); self::definePaths($entryPointLevel, $requestType); - self::checkMainPathsExist(); self::initializeGlobalVariables(); self::initializeGlobalTimeTrackingVariables(); self::initializeBasicErrorReporting(); @@ -127,56 +126,15 @@ class SystemEnvironmentBuilder define('TYPO3_URL_DONATE', 'https://typo3.org/community/contribute/donate/'); define('TYPO3_URL_WIKI_OPCODECACHE', 'https://wiki.typo3.org/Opcode_Cache'); - // @deprecated since TYPO3 v9.4 and will be removed in TYPO3 v10.0 - define('TYPO3_URL_MAILINGLISTS', 'http://lists.typo3.org/cgi-bin/mailman/listinfo'); - define('TYPO3_URL_DOCUMENTATION', 'https://typo3.org/documentation/'); - define('TYPO3_URL_DOCUMENTATION_TSREF', 'https://docs.typo3.org/typo3cms/TyposcriptReference/'); - define('TYPO3_URL_DOCUMENTATION_TSCONFIG', 'https://docs.typo3.org/typo3cms/TSconfigReference/'); - define('TYPO3_URL_CONSULTANCY', 'https://typo3.org/support/professional-services/'); - define('TYPO3_URL_CONTRIBUTE', 'https://typo3.org/contribute/'); - define('TYPO3_URL_SECURITY', 'https://typo3.org/teams/security/'); - define('TYPO3_URL_DOWNLOAD', 'https://typo3.org/download/'); - define('TYPO3_URL_SYSTEMREQUIREMENTS', 'https://typo3.org/typo3-cms/overview/requirements/'); - // A linefeed, a carriage return, a CR-LF combination defined('LF') ?: define('LF', chr(10)); defined('CR') ?: define('CR', chr(13)); defined('CRLF') ?: define('CRLF', CR . LF); - // @deprecated since TYPO3 v9.4 and will be removed in TYPO3 v10.0 - defined('NUL') ?: define('NUL', "\0"); - defined('TAB') ?: define('TAB', "\t"); - defined('SUB') ?: define('SUB', chr(26)); - // Security related constant: Default value of fileDenyPattern define('FILE_DENY_PATTERN_DEFAULT', '\\.(php[3-7]?|phpsh|phtml|pht)(\\..*)?$|^\\.htaccess$'); // Security related constant: List of file extensions that should be registered as php script file extensions define('PHP_EXTENSIONS_DEFAULT', 'php,php3,php4,php5,php6,php7,phpsh,inc,phtml,pht'); - - // Operating system identifier - // Either "WIN" or empty string - defined('TYPO3_OS') ?: define('TYPO3_OS', self::getTypo3Os()); - - // Service error constants - // @deprecated since TYPO3 v9.3, will be removed in TYPO3 v10.0, use the class constants in AbstractService instead. - // General error - something went wrong - define('T3_ERR_SV_GENERAL', -1); - // During execution it showed that the service is not available and should be ignored. The service itself should call $this->setNonAvailable() - define('T3_ERR_SV_NOT_AVAIL', -2); - // Passed subtype is not possible with this service - define('T3_ERR_SV_WRONG_SUBTYPE', -3); - // Passed subtype is not possible with this service - define('T3_ERR_SV_NO_INPUT', -4); - // File not found which the service should process - define('T3_ERR_SV_FILE_NOT_FOUND', -20); - // File not readable - define('T3_ERR_SV_FILE_READ', -21); - // File not writable - define('T3_ERR_SV_FILE_WRITE', -22); - // Passed subtype is not possible with this service - define('T3_ERR_SV_PROG_NOT_FOUND', -40); - // Passed subtype is not possible with this service - define('T3_ERR_SV_PROG_FAILED', -41); } /** @@ -194,7 +152,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')) { if ($isCli && self::usesComposerClassLoading() && StringUtility::endsWith($scriptPath, 'typo3')) { - // PATH_thisScript is used for various path calculations based on the document root + // $scriptPath is used for various path calculations based on the document root // Therefore we assume it is always a subdirectory of the document root, which is not the case // in composer mode on cli, as the binary is in the composer bin directory. // Because of that, we enforce the document root path of this binary to be set @@ -209,10 +167,15 @@ class SystemEnvironmentBuilder $scriptPath = $rootPath . $scriptName; } + if (!is_file($scriptPath)) { + static::exitWithMessage('Unable to determine path to entry script.'); + } + if (!defined('PATH_thisScript')) { // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 define('PATH_thisScript', $scriptPath); } + // Absolute path of the document root of the instance with trailing slash if (!defined('PATH_site')) { // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 @@ -223,28 +186,6 @@ class SystemEnvironmentBuilder if (!defined('TYPO3_mainDir')) { define('TYPO3_mainDir', 'typo3/'); } - // Absolute path of the typo3 directory of the instance with trailing slash - // Example "/var/www/instance-name/htdocs/typo3/" - if (!defined('PATH_typo3')) { - // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - define('PATH_typo3', PATH_site . TYPO3_mainDir); - } - // Absolute path to the typo3conf directory with trailing slash - // Example "/var/www/instance-name/htdocs/typo3conf/" - if (!defined('PATH_typo3conf')) { - // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0 - define('PATH_typo3conf', PATH_site . 'typo3conf/'); - } - } - - /** - * Check if path and script file name calculation was successful, exit if not. - */ - protected static function checkMainPathsExist() - { - if (!is_file(PATH_thisScript)) { - static::exitWithMessage('Unable to determine path to entry script.'); - } } /** @@ -344,7 +285,7 @@ class SystemEnvironmentBuilder } /** - * Calculate PATH_thisScript + * Calculate script path. * * First step in path calculation: Goal is to find the absolute path of the entry script * that was called without resolving any links. This is important since the TYPO3 entry @@ -435,8 +376,8 @@ class SystemEnvironmentBuilder } /** - * Calculate the document root part to the instance from PATH_thisScript. - * This is based on the amount of subdirectories "under" PATH_site where PATH_thisScript is located. + * Calculate the document root part to the instance from $scriptPath. + * This is based on the amount of subdirectories "under" PATH_site where $scriptPath is located. * * The following main scenarios for entry points exist by default in the TYPO3 core: * - Directly called documentRoot/index.php (-> FE call or eiD include): index.php is located in the same directory diff --git a/typo3/sysext/core/Classes/Error/DebugExceptionHandler.php b/typo3/sysext/core/Classes/Error/DebugExceptionHandler.php index 4867bf5a37b8..3dbbe8515cd7 100644 --- a/typo3/sysext/core/Classes/Error/DebugExceptionHandler.php +++ b/typo3/sysext/core/Classes/Error/DebugExceptionHandler.php @@ -443,7 +443,7 @@ STYLESHEET; $content .= '
';
 
                     for ($line = $startLine; $line < $endLine; $line++) {
-                        $codeLine = str_replace(TAB, ' ', $phpFile[$line - 1]);
+                        $codeLine = str_replace("\t", ' ', $phpFile[$line - 1]);
                         $spanClass = '';
                         if ($line === $lineNumber) {
                             $spanClass = 'highlight';
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
index c2e883caf111..97f49ba845a1 100644
--- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
+++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
@@ -648,6 +648,31 @@ The following TypoScript options have been dropped:
 
 The following constants have been dropped:
 
+* :php:`PATH_typo3`
+* :php:`PATH_typo3conf`
+* :php:`T3_ERR_SV_GENERAL`
+* :php:`T3_ERR_SV_FILE_NOT_FOUND`
+* :php:`T3_ERR_SV_FILE_READ`
+* :php:`T3_ERR_SV_FILE_WRITE`
+* :php:`T3_ERR_SV_NO_INPUT`
+* :php:`T3_ERR_SV_NOT_AVAIL`
+* :php:`T3_ERR_SV_PROG_FAILED`
+* :php:`T3_ERR_SV_PROG_NOT_FOUND`
+* :php:`T3_ERR_SV_WRONG_SUBTYPE`
+* :php:`TYPO3_URL_CONSULTANCY`
+* :php:`TYPO3_OS`
+* :php:`TYPO3_URL_CONTRIBUTE`
+* :php:`TYPO3_URL_DOCUMENTATION`
+* :php:`TYPO3_URL_DOCUMENTATION_TSCONFIG`
+* :php:`TYPO3_URL_DOCUMENTATION_TSREF`
+* :php:`TYPO3_URL_DOWNLOAD`
+* :php:`TYPO3_URL_MAILINGLISTS`
+* :php:`TYPO3_URL_SECURITY`
+* :php:`TYPO3_URL_SYSTEMREQUIREMENTS`
+
+
+The following class constants have been dropped:
+
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\BlowfishPasswordHash::ITOA64`
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\BlowfishPasswordHash::HASH_COUNT`
 * :php:`TYPO3\CMS\Core\Crypto\PasswordHashing\BlowfishPasswordHash::MAX_HASH_COUNT`
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
index a3773514afea..90e3bc784401 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php
@@ -23,46 +23,55 @@ return [
     'T3_ERR_SV_GENERAL' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_NOT_AVAIL' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_WRONG_SUBTYPE' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_NO_INPUT' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_FILE_NOT_FOUND' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_FILE_READ' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_FILE_WRITE' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_PROG_NOT_FOUND' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'T3_ERR_SV_PROG_FAILED' => [
         'restFiles' => [
             'Deprecation-85123-ConstantsRelatedToServices.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'PATH_thisScript' => [
@@ -75,78 +84,93 @@ return [
         'restFiles' => [
             'Feature-84153-IntroduceAGenericEnvironmentClass.rst',
             'Deprecation-85285-DeprecatedSystemConstants.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'PATH_typo3conf' => [
         'restFiles' => [
             'Feature-84153-IntroduceAGenericEnvironmentClass.rst',
             'Deprecation-85285-DeprecatedSystemConstants.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'TYPO3_OS' => [
         'restFiles' => [
             'Feature-84153-IntroduceAGenericEnvironmentClass.rst',
             'Deprecation-85285-DeprecatedSystemConstants.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ],
     ],
     'NUL' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TAB' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'SUB' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_SYSTEMREQUIREMENTS' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_DOWNLOAD' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_SECURITY' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_CONTRIBUTE' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_CONSULTANCY' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_DOCUMENTATION_TSCONFIG' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_DOCUMENTATION_TSREF' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_DOCUMENTATION' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
     'TYPO3_URL_MAILINGLISTS' => [
         'restFiles' => [
             'Deprecation-85793-SeveralConstantsFromSystemEnvironmentBuilder.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ],
 ];
-- 
2.20.1