[BUGFIX] Missing initialization of typo3/phar-stream-wrapper 69/58069/11
authorOliver Hader <oliver@typo3.org>
Wed, 29 Aug 2018 12:54:50 +0000 (14:54 +0200)
committerFrans Saris <franssaris@gmail.com>
Fri, 31 Aug 2018 14:11:20 +0000 (16:11 +0200)
Functional tests now rely on \TYPO3\CMS\Core\Core\Bootstrap
is setting up the PharStreamWrapper and check that behavior.

Resolves: #86020
Releases: master
Change-Id: I34637eb42d68196b59e311bde975cff002748206
Reviewed-on: https://review.typo3.org/58069
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
composer.json
composer.lock
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Tests/Functional/IO/PharStreamWrapperInterceptorTest.php
typo3/sysext/core/composer.json

index af78c0d..f94bad0 100644 (file)
@@ -60,7 +60,7 @@
                "typo3/class-alias-loader": "^1.0",
                "typo3/cms-cli": "^2.0",
                "typo3/cms-composer-installers": "^2.0",
-               "typo3/phar-stream-wrapper": "^1.0",
+               "typo3/phar-stream-wrapper": "^1.0.1",
                "typo3fluid/fluid": "^2.5.2"
        },
        "require-dev": {
index 5d582a9..edce038 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": "2b9e27d9ea6bb521fab6bfd77c588843",
+    "content-hash": "229a286ebdeb595d90aff72a696054c1",
     "packages": [
         {
             "name": "cogpowered/finediff",
         },
         {
             "name": "typo3/phar-stream-wrapper",
-            "version": "v1.0.0",
+            "version": "v1.0.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/TYPO3/phar-stream-wrapper.git",
-                "reference": "0db1ca7f8f9f6774dc76b1f7fedbb7e752e0eaa9"
+                "reference": "a93126f06368d4eef6307256481b4b727526238d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/0db1ca7f8f9f6774dc76b1f7fedbb7e752e0eaa9",
-                "reference": "0db1ca7f8f9f6774dc76b1f7fedbb7e752e0eaa9",
+                "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/a93126f06368d4eef6307256481b4b727526238d",
+                "reference": "a93126f06368d4eef6307256481b4b727526238d",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Interceptors for PHP's native phar:// stream handling",
             "homepage": "https://typo3.org/",
-            "time": "2018-08-26T20:18:57+00:00"
+            "time": "2018-08-30T08:08:27+00:00"
         },
         {
             "name": "typo3fluid/fluid",
index 688e13e..15bd350 100644 (file)
@@ -22,12 +22,15 @@ use Psr\Container\NotFoundExceptionInterface;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\IO\PharStreamWrapperInterceptor;
 use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Package\FailsafePackageManager;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\PharStreamWrapper\Behavior;
+use TYPO3\PharStreamWrapper\Manager;
 use TYPO3\PharStreamWrapper\PharStreamWrapper;
 
 /**
@@ -697,6 +700,13 @@ class Bootstrap
     protected static function initializeIO()
     {
         if (in_array('phar', stream_get_wrappers())) {
+            // destroy and re-initialize PharStreamWrapper for TYPO3 core
+            Manager::destroy();
+            Manager::initialize(
+                (new Behavior())
+                    ->withAssertion(new PharStreamWrapperInterceptor())
+            );
+
             stream_wrapper_unregister('phar');
             stream_wrapper_register('phar', PharStreamWrapper::class);
         }
index 637b98d..95984b4 100644 (file)
@@ -16,8 +16,6 @@ namespace TYPO3\CMS\Core\Tests\Functional\IO;
  */
 
 use TYPO3\PharStreamWrapper\Exception;
-use TYPO3\PharStreamWrapper\Manager;
-use TYPO3\PharStreamWrapper\PharStreamWrapper;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
 class PharStreamWrapperInterceptorTest extends FunctionalTestCase
@@ -39,25 +37,12 @@ class PharStreamWrapperInterceptorTest extends FunctionalTestCase
     protected function setUp()
     {
         parent::setUp();
-
         if (!in_array('phar', stream_get_wrappers())) {
             $this->markTestSkipped('Phar stream wrapper is not registered');
         }
-
-        stream_wrapper_unregister('phar');
-        stream_wrapper_register('phar', PharStreamWrapper::class);
-
-        Manager::initialize(
-            (new \TYPO3\PharStreamWrapper\Behavior())
-                ->withAssertion(new \TYPO3\CMS\Core\IO\PharStreamWrapperInterceptor())
-        );
-    }
-
-    protected function tearDown()
-    {
-        stream_wrapper_restore('phar');
-        Manager::destroy();
-        parent::tearDown();
+        // PharStreamWrapper is not initialized here since it relies on being
+        // properly defined in \TYPO3\CMS\Core\Core\Bootstrap - thus, it tests
+        // are expected to fail in case PharStreamWrapper is not initialized
     }
 
     public function directoryActionAllowsInvocationDataProvider()
index 0d5fcbf..8f71aff 100644 (file)
@@ -42,7 +42,7 @@
                "typo3/class-alias-loader": "^1.0",
                "typo3/cms-cli": "^2.0",
                "typo3/cms-composer-installers": "^2.0",
-               "typo3/phar-stream-wrapper": "^1.0",
+               "typo3/phar-stream-wrapper": "^1.0.1",
                "typo3fluid/fluid": "^2.5.2"
        },
        "require-dev": {