[!!!][TASK] Drop constant PATH_site 06/59406/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 11 Jan 2019 11:45:16 +0000 (12:45 +0100)
committerBenni Mack <benni@typo3.org>
Fri, 11 Jan 2019 13:29:24 +0000 (14:29 +0100)
Finally drops the last path related constant from
SystemEnvironmentBuilder. typo3/testing-framework
again needed some adaptions, so this is raised with
the patch as well.

composer require --dev typo3/testing-framework ~5.0.3

Change-Id: Ie8fc311ae8e5180885bc92e007a09f828f26b1e9
Resolves: #87405
Releases: master
Reviewed-on: https://review.typo3.org/59406
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
composer.json
composer.lock
typo3/sysext/core/Classes/Core/Environment.php
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/core/composer.json
typo3/sysext/felogin/Tests/Unit/Controller/FrontendLoginControllerTest.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstantMatcher.php

index a496188..b3e0b93 100644 (file)
@@ -68,7 +68,7 @@
                "fiunchinho/phpunit-randomizer": "^4.0",
                "friendsofphp/php-cs-fixer": "^2.12.2",
                "typo3/cms-styleguide": "~10.0.2",
-               "typo3/testing-framework": "~5.0.2"
+               "typo3/testing-framework": "~5.0.3"
        },
        "suggest": {
                "ext-gd": "GDlib/Freetype is required for building images with text (GIFBUILDER) and can also be used to scale images",
index aa897e8..724d82d 100644 (file)
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "aeb31e0c5d202a7441722af3f3bdca32",
+    "content-hash": "6189051a464f1004eb6a4d1d5637fdf3",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "typo3/testing-framework",
-            "version": "5.0.2",
+            "version": "5.0.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/testing-framework.git",
-                "reference": "3c533f83d254ebcda7eea0bdbd7f4e2cb30f574b"
+                "reference": "9c47cb61fd9c7522c65ca45ff97e3b5a26c6fa22"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/3c533f83d254ebcda7eea0bdbd7f4e2cb30f574b",
-                "reference": "3c533f83d254ebcda7eea0bdbd7f4e2cb30f574b",
+                "url": "https://api.github.com/repos/TYPO3/testing-framework/zipball/9c47cb61fd9c7522c65ca45ff97e3b5a26c6fa22",
+                "reference": "9c47cb61fd9c7522c65ca45ff97e3b5a26c6fa22",
                 "shasum": ""
             },
             "require": {
                 "tests",
                 "typo3"
             ],
-            "time": "2019-01-10T12:43:35+00:00"
+            "time": "2019-01-11T12:54:17+00:00"
         },
         {
             "name": "webmozart/assert",
index 8a131c3..43de5a7 100644 (file)
@@ -32,7 +32,6 @@ namespace TYPO3\CMS\Core\Core;
  *
  * In your application, use it like this:
  *
- * Instead of writing "PATH_site" call "Environment::getPublicPath() . '/'"
  * Instead of writing "TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI" call "Environment::isCli()"
  */
 class Environment
@@ -134,8 +133,8 @@ class Environment
     }
 
     /**
-     * The public web folder where index.php (= the frontend application) is put. This is equal to the legacy constant
-     * PATH_site, without the trailing slash. For non-composer installations, the project path = the public path.
+     * The public web folder where index.php (= the frontend application) is put, without trailing slash.
+     * For non-composer installations, the project path = the public path.
      *
      * @return string
      */
@@ -226,7 +225,6 @@ class Environment
     }
 
     /**
-     * Previously known as PATH_site . 'typo3conf/ext/'
      * Please note that this might be gone at some point
      *
      * @return string
index a468c44..a712122 100644 (file)
@@ -88,18 +88,12 @@ class SystemEnvironmentBuilder
         $scriptPath = self::calculateScriptPath($entryPointLevel, $requestType);
         $rootPath = self::calculateRootPath($entryPointLevel, $requestType);
 
-        if (!defined('PATH_site')) {
-            // Absolute path of the document root of the instance with trailing slash
-            // @deprecated since TYPO3 v9, will be removed in TYPO3 v10.0
-            define('PATH_site', $rootPath . '/');
-        }
-
         self::initializeGlobalVariables();
         self::initializeGlobalTimeTrackingVariables();
         self::initializeBasicErrorReporting();
 
         $applicationContext = static::createApplicationContext();
-        self::initializeEnvironment($applicationContext, $requestType, $scriptPath);
+        self::initializeEnvironment($applicationContext, $requestType, $scriptPath, $rootPath);
         GeneralUtility::presetApplicationContext($applicationContext);
     }
 
@@ -243,14 +237,12 @@ class SystemEnvironmentBuilder
      * @param ApplicationContext $context
      * @param int $requestType
      * @param string $scriptPath
+     * @param string $sitePath
      */
-    protected static function initializeEnvironment(ApplicationContext $context, int $requestType, string $scriptPath)
+    protected static function initializeEnvironment(ApplicationContext $context, int $requestType, string $scriptPath, string $sitePath)
     {
-        // Absolute path of the entry script that was called
-        $sitePath = rtrim(PATH_site, '/');
-
         if (getenv('TYPO3_PATH_ROOT')) {
-            $rootPathFromEnvironment = GeneralUtility::fixWindowsFilePath(getenv('TYPO3_PATH_ROOT'));
+            $rootPathFromEnvironment = rtrim(GeneralUtility::fixWindowsFilePath(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
@@ -311,7 +303,7 @@ class SystemEnvironmentBuilder
      * points are often linked to a central core location, so we can not use the php magic
      * __FILE__ here, but resolve the called script path from given server environments.
      *
-     * This path is important to calculate the document root (PATH_site). The strategy is to
+     * This path is important to calculate the document root. The strategy is to
      * find out the script name that was called in the first place and to subtract the local
      * part from it to find the document root.
      *
@@ -396,7 +388,7 @@ class SystemEnvironmentBuilder
 
     /**
      * 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.
+     * This is based on the amount of subdirectories "under" root path 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
index a2bdccd..9671b9e 100644 (file)
@@ -51,7 +51,7 @@
                "fiunchinho/phpunit-randomizer": "^4.0",
                "friendsofphp/php-cs-fixer": "^2.12.2",
                "typo3/cms-styleguide": "~10.0.2",
-               "typo3/testing-framework": "~5.0.2"
+               "typo3/testing-framework": "~5.0.3"
        },
        "suggest": {
                "ext-fileinfo": "Used for proper file type detection in the file abstraction layer",
index 5b3ddff..8284a2a 100644 (file)
@@ -114,6 +114,17 @@ class FrontendLoginControllerTest extends UnitTestCase
      */
     public function validateRedirectUrlClearsUrl($url)
     {
+        Environment::initialize(
+            Environment::getContext(),
+            true,
+            false,
+            Environment::getProjectPath(),
+            Environment::getPublicPath(),
+            Environment::getVarPath(),
+            Environment::getConfigPath(),
+            Environment::getBackendPath() . '/index.php',
+            Environment::isWindows() ? 'WINDOWS' : 'UNIX'
+        );
         $this->assertEquals('', $this->accessibleFixture->_call('validateRedirectUrl', $url));
     }
 
index c7120c5..ee8ce48 100644 (file)
@@ -177,6 +177,7 @@ return [
     'PATH_site' => [
         'restFiles' => [
             'Deprecation-85285-DeprecatedSystemConstants.rst',
+            'Breaking-87193-DeprecatedFunctionalityRemoved.rst',
         ]
     ]
 ];