[BUGFIX] Package Management only allows TYPO3 Extensions 32/39632/6
authorBenjamin Mack <benni@typo3.org>
Wed, 20 May 2015 13:21:33 +0000 (21:21 +0800)
committerHelmut Hummel <helmut.hummel@typo3.org>
Thu, 21 May 2015 17:15:15 +0000 (19:15 +0200)
Fix a bug in the recent Package Management refactoring resulting in
Package instances only allowed if they contain an ext_emconf.php file.
This basically disallows any third-party code installed inside
Packages/ due to checking if an ext_emconf.php is present before
checking for a composer file.

Resolves: #67060
Releases: master
Change-Id: I1bec43faafc0c073da52c3bbb1945f47f6864930
Reviewed-on: http://review.typo3.org/39632
Reviewed-by: Stephan Großberndt <stephan@grossberndt.de>
Tested-by: Stephan Großberndt <stephan@grossberndt.de>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/core/Classes/Package/Package.php

index a524d5b..ee6400d 100644 (file)
@@ -125,9 +125,6 @@ class Package implements PackageInterface {
                if (substr($packagePath, -1, 1) !== '/') {
                        throw new Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633722);
                }
-               if (!@file_exists($packagePath . 'ext_emconf.php')) {
-                       throw new Exception\InvalidPackageManifestException(sprintf('No ext_emconf.php file found for package "%s".".', $packageKey), 1360403545);
-               }
                $this->packageManager = $packageManager;
                $this->packageKey = $packageKey;
                $this->packagePath = PathUtility::sanitizeTrailingSeparator($packagePath);
@@ -135,7 +132,9 @@ class Package implements PackageInterface {
                try {
                        $this->getComposerManifest();
                } catch (Exception\MissingPackageManifestException $exception) {
-                       $this->getExtensionEmconf();
+                       if (!$this->loadExtensionEmconf()) {
+                               throw new Exception\InvalidPackageManifestException('No valid ext_emconf.php file found for package "' . $packageKey . '".', 1360403545);
+                       }
                }
                $this->loadFlagsFromComposerManifest();
        }
@@ -263,15 +262,16 @@ class Package implements PackageInterface {
        /**
         * @return bool
         */
-       protected function getExtensionEmconf() {
+       protected function loadExtensionEmconf() {
                $_EXTKEY = $this->packageKey;
-               $path = $this->packagePath . '/ext_emconf.php';
+               $path = $this->packagePath . 'ext_emconf.php';
                $EM_CONF = NULL;
                if (@file_exists($path)) {
                        include $path;
                        if (is_array($EM_CONF[$_EXTKEY])) {
                                $this->extensionManagerConfiguration = $EM_CONF[$_EXTKEY];
                                $this->mapExtensionManagerConfigurationToComposerManifest();
+                               return TRUE;
                        }
                }
                return FALSE;