diff --git a/.gitignore b/.gitignore index bbf57c0afb767..e827b20531ff9 100644 --- a/.gitignore +++ b/.gitignore @@ -70,6 +70,13 @@ Desktop.ini # Extra files installed by Composer not needed in the CMS environment # This should only ignore files like unit testing or READMEs, production # code must remain to ensure all libraries properly function +/libraries/vendor/brumann/polyfill-unserialize/.gitignore +/libraries/vendor/brumann/polyfill-unserialize/.travis.yml +/libraries/vendor/brumann/polyfill-unserialize/composer.json +/libraries/vendor/brumann/polyfill-unserialize/LICENSE +/libraries/vendor/brumann/polyfill-unserialize/phpunit.xml.dist +/libraries/vendor/brumann/polyfill-unserialize/README.md +/libraries/vendor/brumann/polyfill-unserialize/tests /libraries/vendor/google/recaptcha/examples /libraries/vendor/google/recaptcha/tests /libraries/vendor/google/recaptcha/.gitignore @@ -193,9 +200,14 @@ Desktop.ini /libraries/vendor/simplepie/simplepie/build /libraries/vendor/simplepie/simplepie/idn/ReadMe.txt /libraries/vendor/simplepie/simplepie/composer.json -/libraries/vendor/typo3/phar-stream-wrapper/README.md -/libraries/vendor/typo3/phar-stream-wrapper/LICENSE +/libraries/vendor/typo3/phar-stream-wrapper/tests +/libraries/vendor/typo3/phar-stream-wrapper/.gitattributes /libraries/vendor/typo3/phar-stream-wrapper/.gitignore +/libraries/vendor/typo3/phar-stream-wrapper/.travis.yml +/libraries/vendor/typo3/phar-stream-wrapper/composer.json +/libraries/vendor/typo3/phar-stream-wrapper/LICENSE +/libraries/vendor/typo3/phar-stream-wrapper/phpunit.xml +/libraries/vendor/typo3/phar-stream-wrapper/README.md # System Test related files tests/codeception/acceptance.suite.yml diff --git a/composer.json b/composer.json index df1686f47947f..a4ddef65e5d59 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "symfony/yaml": "2.*", "simplepie/simplepie": "1.3.1", "google/recaptcha": "^1.1", - "typo3/phar-stream-wrapper": "^2.0" + "typo3/phar-stream-wrapper": "^2.1" }, "require-dev": { "phpunit/phpunit": "^4.8.35", diff --git a/composer.lock b/composer.lock index bbf5100342e5e..cc42a2e5b1cf9 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,47 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9870443c0387f9ba2d819085f35e5c86", + "content-hash": "4fb2cf95954e5222f187ff2959187d72", "packages": [ + { + "name": "brumann/polyfill-unserialize", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/dbrumann/polyfill-unserialize.git", + "reference": "844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dbrumann/polyfill-unserialize/zipball/844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b", + "reference": "844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Brumann\\Polyfill\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Denis Brumann", + "email": "denis.brumann@sensiolabs.de" + } + ], + "description": "Backports unserialize options introduced in PHP 7.0 to older PHP versions.", + "time": "2017-02-03T09:55:47+00:00" + }, { "name": "google/recaptcha", "version": "1.1.2", @@ -1675,19 +1711,22 @@ }, { "name": "typo3/phar-stream-wrapper", - "version": "v2.0.1", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/TYPO3/phar-stream-wrapper.git", - "reference": "0469d9fefa0146ea4299d3b11cfbb76faa7045bf" + "reference": "b7a21f0859059ed5d9754af8c11f852d43762334" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/0469d9fefa0146ea4299d3b11cfbb76faa7045bf", - "reference": "0469d9fefa0146ea4299d3b11cfbb76faa7045bf", + "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/b7a21f0859059ed5d9754af8c11f852d43762334", + "reference": "b7a21f0859059ed5d9754af8c11f852d43762334", "shasum": "" }, "require": { + "brumann/polyfill-unserialize": "^1.0", + "ext-fileinfo": "*", + "ext-json": "*", "php": "^5.3.3|^7.0" }, "require-dev": { @@ -1711,7 +1750,7 @@ "security", "stream-wrapper" ], - "time": "2018-10-18T08:46:28+00:00" + "time": "2019-03-01T17:43:52+00:00" } ], "packages-dev": [ @@ -2423,6 +2462,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2015-10-02T06:51:40+00:00" }, { diff --git a/libraries/vendor/brumann/polyfill-unserialize/LICENSE b/libraries/vendor/brumann/polyfill-unserialize/LICENSE new file mode 100644 index 0000000000000..0cb53d3b0261b --- /dev/null +++ b/libraries/vendor/brumann/polyfill-unserialize/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Denis Brumann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/libraries/vendor/brumann/polyfill-unserialize/composer.json b/libraries/vendor/brumann/polyfill-unserialize/composer.json new file mode 100644 index 0000000000000..ec4a2cf0eab37 --- /dev/null +++ b/libraries/vendor/brumann/polyfill-unserialize/composer.json @@ -0,0 +1,26 @@ +{ + "name": "brumann/polyfill-unserialize", + "description": "Backports unserialize options introduced in PHP 7.0 to older PHP versions.", + "type": "library", + "license": "MIT", + "authors": [ + { + "name": "Denis Brumann", + "email": "denis.brumann@sensiolabs.de" + } + ], + "autoload": { + "psr-4": { + "Brumann\\Polyfill\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\Brumann\\Polyfill\\": "tests/" + } + }, + "minimum-stability": "stable", + "require": { + "php": "^5.3|^7.0" + } +} diff --git a/libraries/vendor/brumann/polyfill-unserialize/src/Unserialize.php b/libraries/vendor/brumann/polyfill-unserialize/src/Unserialize.php new file mode 100644 index 0000000000000..e025d55ed4ef2 --- /dev/null +++ b/libraries/vendor/brumann/polyfill-unserialize/src/Unserialize.php @@ -0,0 +1,58 @@ += 70000) { + return \unserialize($serialized, $options); + } + if (!array_key_exists('allowed_classes', $options)) { + $options['allowed_classes'] = true; + } + $allowedClasses = $options['allowed_classes']; + if (true === $allowedClasses) { + return \unserialize($serialized); + } + if (false === $allowedClasses) { + $allowedClasses = array(); + } + if (!is_array($allowedClasses)) { + trigger_error( + 'unserialize(): allowed_classes option should be array or boolean', + E_USER_WARNING + ); + $allowedClasses = array(); + } + + $sanitizedSerialized = preg_replace_callback( + '/(^|;)O:\d+:"([^"]*)":(\d+):{/', + function ($match) use ($allowedClasses) { + list($completeMatch, $leftBorder, $className, $objectSize) = $match; + if (in_array($className, $allowedClasses)) { + return $completeMatch; + } else { + return sprintf( + '%sO:22:"__PHP_Incomplete_Class":%d:{s:27:"__PHP_Incomplete_Class_Name";%s', + $leftBorder, + $objectSize + 1, // size of object + 1 for added string + \serialize($className) + ); + } + }, + $serialized + ); + + return \unserialize($sanitizedSerialized); + } +} diff --git a/libraries/vendor/composer/ClassLoader.php b/libraries/vendor/composer/ClassLoader.php index dc02dfb114fb6..fce8549f0781b 100644 --- a/libraries/vendor/composer/ClassLoader.php +++ b/libraries/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ public function isClassMapAuthoritative() */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** @@ -377,7 +377,7 @@ private function findFileWithExtension($class, $ext) $subPath = $class; while (false !== $lastPos = strrpos($subPath, '\\')) { $subPath = substr($subPath, 0, $lastPos); - $search = $subPath.'\\'; + $search = $subPath . '\\'; if (isset($this->prefixDirsPsr4[$search])) { $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); foreach ($this->prefixDirsPsr4[$search] as $dir) { diff --git a/libraries/vendor/composer/autoload_classmap.php b/libraries/vendor/composer/autoload_classmap.php index d937cc77e10cd..1ee0173d22d18 100644 --- a/libraries/vendor/composer/autoload_classmap.php +++ b/libraries/vendor/composer/autoload_classmap.php @@ -6,6 +6,7 @@ $baseDir = dirname(dirname($vendorDir)); return array( + 'Brumann\\Polyfill\\Unserialize' => $vendorDir . '/brumann/polyfill-unserialize/src/Unserialize.php', 'CallbackFilterIterator' => $vendorDir . '/joomla/compat/src/CallbackFilterIterator.php', 'EasyPeasyICS' => $vendorDir . '/phpmailer/phpmailer/extras/EasyPeasyICS.php', 'Joomla\\Application\\AbstractApplication' => $vendorDir . '/joomla/application/src/AbstractApplication.php', @@ -188,11 +189,24 @@ 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryOnFuncOverload.php', 'TYPO3\\PharStreamWrapper\\Assertable' => $vendorDir . '/typo3/phar-stream-wrapper/src/Assertable.php', 'TYPO3\\PharStreamWrapper\\Behavior' => $vendorDir . '/typo3/phar-stream-wrapper/src/Behavior.php', + 'TYPO3\\PharStreamWrapper\\Collectable' => $vendorDir . '/typo3/phar-stream-wrapper/src/Collectable.php', 'TYPO3\\PharStreamWrapper\\Exception' => $vendorDir . '/typo3/phar-stream-wrapper/src/Exception.php', 'TYPO3\\PharStreamWrapper\\Helper' => $vendorDir . '/typo3/phar-stream-wrapper/src/Helper.php', + 'TYPO3\\PharStreamWrapper\\Interceptor\\ConjunctionInterceptor' => $vendorDir . '/typo3/phar-stream-wrapper/src/Interceptor/ConjunctionInterceptor.php', 'TYPO3\\PharStreamWrapper\\Interceptor\\PharExtensionInterceptor' => $vendorDir . '/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php', + 'TYPO3\\PharStreamWrapper\\Interceptor\\PharMetaDataInterceptor' => $vendorDir . '/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php', 'TYPO3\\PharStreamWrapper\\Manager' => $vendorDir . '/typo3/phar-stream-wrapper/src/Manager.php', 'TYPO3\\PharStreamWrapper\\PharStreamWrapper' => $vendorDir . '/typo3/phar-stream-wrapper/src/PharStreamWrapper.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Container' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/Container.php', + 'TYPO3\\PharStreamWrapper\\Phar\\DeserializationException' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/DeserializationException.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Manifest' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/Manifest.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Reader' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/Reader.php', + 'TYPO3\\PharStreamWrapper\\Phar\\ReaderException' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/ReaderException.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Stub' => $vendorDir . '/typo3/phar-stream-wrapper/src/Phar/Stub.php', + 'TYPO3\\PharStreamWrapper\\Resolvable' => $vendorDir . '/typo3/phar-stream-wrapper/src/Resolvable.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocation' => $vendorDir . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocationCollection' => $vendorDir . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocationResolver' => $vendorDir . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php', 'lessc' => $vendorDir . '/leafo/lessphp/lessc.inc.php', 'lessc_formatter_classic' => $vendorDir . '/leafo/lessphp/lessc.inc.php', 'lessc_formatter_compressed' => $vendorDir . '/leafo/lessphp/lessc.inc.php', diff --git a/libraries/vendor/composer/autoload_psr4.php b/libraries/vendor/composer/autoload_psr4.php index b0083c70f812c..1b034a88523b9 100644 --- a/libraries/vendor/composer/autoload_psr4.php +++ b/libraries/vendor/composer/autoload_psr4.php @@ -33,4 +33,5 @@ 'Joomla\\DI\\' => array($vendorDir . '/joomla/di/src'), 'Joomla\\Archive\\' => array($vendorDir . '/joomla/archive/src'), 'Joomla\\Application\\' => array($vendorDir . '/joomla/application/src'), + 'Brumann\\Polyfill\\' => array($vendorDir . '/brumann/polyfill-unserialize/src'), ); diff --git a/libraries/vendor/composer/autoload_static.php b/libraries/vendor/composer/autoload_static.php index 1c09839b3a1e6..3a0cfdbaca319 100644 --- a/libraries/vendor/composer/autoload_static.php +++ b/libraries/vendor/composer/autoload_static.php @@ -75,6 +75,10 @@ class ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe 'Joomla\\Archive\\' => 15, 'Joomla\\Application\\' => 19, ), + 'B' => + array ( + 'Brumann\\Polyfill\\' => 17, + ), ); public static $prefixDirsPsr4 = array ( @@ -186,6 +190,10 @@ class ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe array ( 0 => __DIR__ . '/..' . '/joomla/application/src', ), + 'Brumann\\Polyfill\\' => + array ( + 0 => __DIR__ . '/..' . '/brumann/polyfill-unserialize/src', + ), ); public static $prefixesPsr0 = array ( @@ -206,6 +214,7 @@ class ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe ); public static $classMap = array ( + 'Brumann\\Polyfill\\Unserialize' => __DIR__ . '/..' . '/brumann/polyfill-unserialize/src/Unserialize.php', 'CallbackFilterIterator' => __DIR__ . '/..' . '/joomla/compat/src/CallbackFilterIterator.php', 'EasyPeasyICS' => __DIR__ . '/..' . '/phpmailer/phpmailer/extras/EasyPeasyICS.php', 'Joomla\\Application\\AbstractApplication' => __DIR__ . '/..' . '/joomla/application/src/AbstractApplication.php', @@ -388,11 +397,24 @@ class ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryOnFuncOverload.php', 'TYPO3\\PharStreamWrapper\\Assertable' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Assertable.php', 'TYPO3\\PharStreamWrapper\\Behavior' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Behavior.php', + 'TYPO3\\PharStreamWrapper\\Collectable' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Collectable.php', 'TYPO3\\PharStreamWrapper\\Exception' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Exception.php', 'TYPO3\\PharStreamWrapper\\Helper' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Helper.php', + 'TYPO3\\PharStreamWrapper\\Interceptor\\ConjunctionInterceptor' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Interceptor/ConjunctionInterceptor.php', 'TYPO3\\PharStreamWrapper\\Interceptor\\PharExtensionInterceptor' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php', + 'TYPO3\\PharStreamWrapper\\Interceptor\\PharMetaDataInterceptor' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php', 'TYPO3\\PharStreamWrapper\\Manager' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Manager.php', 'TYPO3\\PharStreamWrapper\\PharStreamWrapper' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/PharStreamWrapper.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Container' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/Container.php', + 'TYPO3\\PharStreamWrapper\\Phar\\DeserializationException' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/DeserializationException.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Manifest' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/Manifest.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Reader' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/Reader.php', + 'TYPO3\\PharStreamWrapper\\Phar\\ReaderException' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/ReaderException.php', + 'TYPO3\\PharStreamWrapper\\Phar\\Stub' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Phar/Stub.php', + 'TYPO3\\PharStreamWrapper\\Resolvable' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Resolvable.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocation' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocation.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocationCollection' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php', + 'TYPO3\\PharStreamWrapper\\Resolver\\PharInvocationResolver' => __DIR__ . '/..' . '/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php', 'lessc' => __DIR__ . '/..' . '/leafo/lessphp/lessc.inc.php', 'lessc_formatter_classic' => __DIR__ . '/..' . '/leafo/lessphp/lessc.inc.php', 'lessc_formatter_compressed' => __DIR__ . '/..' . '/leafo/lessphp/lessc.inc.php', diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 04c85e4f0bad6..11272759e960f 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -1,4 +1,42 @@ [ + { + "name": "brumann/polyfill-unserialize", + "version": "v1.0.3", + "version_normalized": "1.0.3.0", + "source": { + "type": "git", + "url": "https://github.com/dbrumann/polyfill-unserialize.git", + "reference": "844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dbrumann/polyfill-unserialize/zipball/844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b", + "reference": "844d7e44b62a1a3d5c68cfb7ebbd59c17ea0fd7b", + "shasum": "" + }, + "require": { + "php": "^5.3|^7.0" + }, + "time": "2017-02-03T09:55:47+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Brumann\\Polyfill\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Denis Brumann", + "email": "denis.brumann@sensiolabs.de" + } + ], + "description": "Backports unserialize options introduced in PHP 7.0 to older PHP versions." + }, { "name": "google/recaptcha", "version": "1.1.2", @@ -1732,28 +1770,31 @@ }, { "name": "typo3/phar-stream-wrapper", - "version": "v2.0.1", - "version_normalized": "2.0.1.0", + "version": "v2.1.0", + "version_normalized": "2.1.0.0", "source": { "type": "git", "url": "https://github.com/TYPO3/phar-stream-wrapper.git", - "reference": "0469d9fefa0146ea4299d3b11cfbb76faa7045bf" + "reference": "b7a21f0859059ed5d9754af8c11f852d43762334" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/0469d9fefa0146ea4299d3b11cfbb76faa7045bf", - "reference": "0469d9fefa0146ea4299d3b11cfbb76faa7045bf", + "url": "https://api.github.com/repos/TYPO3/phar-stream-wrapper/zipball/b7a21f0859059ed5d9754af8c11f852d43762334", + "reference": "b7a21f0859059ed5d9754af8c11f852d43762334", "shasum": "" }, "require": { + "brumann/polyfill-unserialize": "^1.0", + "ext-fileinfo": "*", + "ext-json": "*", "php": "^5.3.3|^7.0" }, "require-dev": { "phpunit/phpunit": "^4.8.36" }, - "time": "2018-10-18T08:46:28+00:00", + "time": "2019-03-01T17:43:52+00:00", "type": "library", - "installation-source": "dist", + "installation-source": "source", "autoload": { "psr-4": { "TYPO3\\PharStreamWrapper\\": "src/" diff --git a/libraries/vendor/typo3/phar-stream-wrapper/composer.json b/libraries/vendor/typo3/phar-stream-wrapper/composer.json index d308f8c87413a..f1d25a070d6b2 100644 --- a/libraries/vendor/typo3/phar-stream-wrapper/composer.json +++ b/libraries/vendor/typo3/phar-stream-wrapper/composer.json @@ -6,7 +6,10 @@ "homepage": "https://typo3.org/", "keywords": ["php", "phar", "stream-wrapper", "security"], "require": { - "php": "^5.3.3|^7.0" + "php": "^5.3.3|^7.0", + "ext-fileinfo": "*", + "ext-json": "*", + "brumann/polyfill-unserialize": "^1.0" }, "require-dev": { "phpunit/phpunit": "^4.8.36" diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Collectable.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Collectable.php new file mode 100644 index 0000000000000..0ad2783d24ebc --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Collectable.php @@ -0,0 +1,31 @@ +assertAssertions($assertions); + $this->assertions = $assertions; + } + + /** + * Executes assertions based on all contained assertions. + * + * @param string $path + * @param string $command + * @return bool + * @throws Exception + */ + public function assert($path, $command) + { + if ($this->invokeAssertions($path, $command)) { + return true; + } + throw new Exception( + sprintf( + 'Assertion failed in "%s"', + $path + ), + 1539625084 + ); + } + + /** + * @param Assertable[] $assertions + */ + private function assertAssertions(array $assertions) + { + foreach ($assertions as $assertion) { + if (!$assertion instanceof Assertable) { + throw new \InvalidArgumentException( + sprintf( + 'Instance %s must implement Assertable', + get_class($assertion) + ), + 1539624719 + ); + } + } + } + + /** + * @param string $path + * @param string $command + * @return bool + */ + private function invokeAssertions($path, $command) + { + try { + foreach ($this->assertions as $assertion) { + if (!$assertion->assert($path, $command)) { + return false; + } + } + } catch (Exception $exception) { + return false; + } + return true; + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php index db500afc8a730..6e7aeedcbe799 100644 --- a/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharExtensionInterceptor.php @@ -12,8 +12,8 @@ */ use TYPO3\PharStreamWrapper\Assertable; -use TYPO3\PharStreamWrapper\Helper; use TYPO3\PharStreamWrapper\Exception; +use TYPO3\PharStreamWrapper\Manager; class PharExtensionInterceptor implements Assertable { @@ -45,11 +45,11 @@ public function assert($path, $command) */ private function baseFileContainsPharExtension($path) { - $baseFile = Helper::determineBaseFile($path); - if ($baseFile === null) { + $invocation = Manager::instance()->resolve($path); + if ($invocation === null) { return false; } - $fileExtension = pathinfo($baseFile, PATHINFO_EXTENSION); + $fileExtension = pathinfo($invocation->getBaseName(), PATHINFO_EXTENSION); return strtolower($fileExtension) === 'phar'; } } diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php new file mode 100644 index 0000000000000..a1224a2504398 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php @@ -0,0 +1,68 @@ +baseFileDoesNotHaveMetaDataIssues($path)) { + return true; + } + throw new Exception( + sprintf( + 'Problematic meta-data in "%s"', + $path + ), + 1539632368 + ); + } + + /** + * @param string $path + * @return bool + */ + private function baseFileDoesNotHaveMetaDataIssues($path) + { + $invocation = Manager::instance()->resolve($path); + if ($invocation === null) { + return false; + } + + try { + $reader = new Reader($invocation->getBaseName()); + $reader->resolveContainer()->getManifest()->deserializeMetaData(); + } catch (DeserializationException $exception) { + return false; + } + return true; + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Manager.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Manager.php index 1eb9735d9862a..f938ad9854131 100644 --- a/libraries/vendor/typo3/phar-stream-wrapper/src/Manager.php +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Manager.php @@ -11,7 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -class Manager implements Assertable +use TYPO3\PharStreamWrapper\Resolver\PharInvocation; +use TYPO3\PharStreamWrapper\Resolver\PharInvocationCollection; +use TYPO3\PharStreamWrapper\Resolver\PharInvocationResolver; + +class Manager { /** * @var self @@ -23,14 +27,29 @@ class Manager implements Assertable */ private $behavior; + /** + * @var Resolvable + */ + private $resolver; + + /** + * @var Collectable + */ + private $collection; + /** * @param Behavior $behaviour + * @param Resolvable $resolver + * @param Collectable $collection * @return self */ - public static function initialize(Behavior $behaviour) - { + public static function initialize( + Behavior $behaviour, + Resolvable $resolver = null, + Collectable $collection = null + ) { if (self::$instance === null) { - self::$instance = new self($behaviour); + self::$instance = new self($behaviour, $resolver, $collection); return self::$instance; } throw new \LogicException( @@ -67,9 +86,22 @@ public static function destroy() /** * @param Behavior $behaviour + * @param Resolvable $resolver + * @param Collectable $collection */ - private function __construct(Behavior $behaviour) - { + private function __construct( + Behavior $behaviour, + Resolvable $resolver = null, + Collectable $collection = null + ) { + if ($collection === null) { + $collection = new PharInvocationCollection(); + } + if ($resolver === null) { + $resolver = new PharInvocationResolver(); + } + $this->collection = $collection; + $this->resolver = $resolver; $this->behavior = $behaviour; } @@ -82,4 +114,22 @@ public function assert($path, $command) { return $this->behavior->assert($path, $command); } + + /** + * @param string $path + * @param null|int $flags + * @return null|PharInvocation + */ + public function resolve($path, $flags = null) + { + return $this->resolver->resolve($path, $flags); + } + + /** + * @return Collectable + */ + public function getCollection() + { + return $this->collection; + } } diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php new file mode 100644 index 0000000000000..3fbbaa57b03e7 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Container.php @@ -0,0 +1,59 @@ +stub = $stub; + $this->manifest = $manifest; + } + + /** + * @return Stub + */ + public function getStub() + { + return $this->stub; + } + + /** + * @return Manifest + */ + public function getManifest() + { + return $this->manifest; + } + + /** + * @return string + */ + public function getAlias() + { + return $this->stub->getMappedAlias() ?: $this->manifest->getAlias(); + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/DeserializationException.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/DeserializationException.php new file mode 100644 index 0000000000000..5a675d34fe909 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/DeserializationException.php @@ -0,0 +1,18 @@ +manifestLength = Reader::resolveFourByteLittleEndian($content, 0); + $target->amountOfFiles = Reader::resolveFourByteLittleEndian($content, 4); + $target->flags = Reader::resolveFourByteLittleEndian($content, 10); + $target->aliasLength = Reader::resolveFourByteLittleEndian($content, 14); + $target->alias = substr($content, 18, $target->aliasLength); + $target->metaDataLength = Reader::resolveFourByteLittleEndian($content, 18 + $target->aliasLength); + $target->metaData = substr($content, 22 + $target->aliasLength, $target->metaDataLength); + + $apiVersionNibbles = Reader::resolveTwoByteBigEndian($content, 8); + $target->apiVersion = implode('.', array( + ($apiVersionNibbles & 0xf000) >> 12, + ($apiVersionNibbles & 0x0f00) >> 8, + ($apiVersionNibbles & 0x00f0) >> 4, + )); + + return $target; + } + + /** + * @var int + */ + private $manifestLength; + + /** + * @var int + */ + private $amountOfFiles; + + /** + * @var string + */ + private $apiVersion; + + /** + * @var int + */ + private $flags; + + /** + * @var int + */ + private $aliasLength; + + /** + * @var string + */ + private $alias; + + /** + * @var int + */ + private $metaDataLength; + + /** + * @var string + */ + private $metaData; + + /** + * Avoid direct instantiation. + */ + private function __construct() + { + } + + /** + * @return int + */ + public function getManifestLength() + { + return $this->manifestLength; + } + + /** + * @return int + */ + public function getAmountOfFiles() + { + return $this->amountOfFiles; + } + + /** + * @return string + */ + public function getApiVersion() + { + return $this->apiVersion; + } + + /** + * @return int + */ + public function getFlags() + { + return $this->flags; + } + + /** + * @return int + */ + public function getAliasLength() + { + return $this->aliasLength; + } + + /** + * @return string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * @return int + */ + public function getMetaDataLength() + { + return $this->metaDataLength; + } + + /** + * @return string + */ + public function getMetaData() + { + return $this->metaData; + } + + /** + * @return mixed|null + */ + public function deserializeMetaData() + { + if (empty($this->metaData)) { + return null; + } + + $result = Unserialize::unserialize($this->metaData, array('allowed_classes' => false)); + + $serialized = json_encode($result); + if (strpos($serialized, '__PHP_Incomplete_Class_Name') !== false) { + throw new DeserializationException( + 'Meta-data contains serialized object', + 1539623382 + ); + } + + return $result; + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php new file mode 100644 index 0000000000000..faa254fbd9d5d --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/Reader.php @@ -0,0 +1,222 @@ +fileName = $fileName; + $this->fileType = $this->determineFileType(); + } + + /** + * @return Container + */ + public function resolveContainer() + { + $data = $this->extractData($this->resolveStream() . $this->fileName); + + if ($data['stubContent'] === null) { + throw new ReaderException( + 'Cannot resolve stub', + 1547807881 + ); + } + if ($data['manifestContent'] === null || $data['manifestLength'] === null) { + throw new ReaderException( + 'Cannot resolve manifest', + 1547807882 + ); + } + if (strlen($data['manifestContent']) < $data['manifestLength']) { + throw new ReaderException( + sprintf( + 'Exected manifest length %d, got %d', + strlen($data['manifestContent']), + $data['manifestLength'] + ), + 1547807883 + ); + } + + return new Container( + Stub::fromContent($data['stubContent']), + Manifest::fromContent($data['manifestContent']) + ); + } + + /** + * @param string $fileName e.g. '/path/file.phar' or 'compress.zlib:///path/file.phar' + * @return array + */ + private function extractData($fileName) + { + $stubContent = null; + $manifestContent = null; + $manifestLength = null; + + $resource = fopen($fileName, 'r'); + if (!is_resource($resource)) { + throw new ReaderException( + sprintf('Resource %s could not be opened', $fileName), + 1547902055 + ); + } + + while (!feof($resource)) { + $line = fgets($resource); + // stop reading file when manifest can be extracted + if ($manifestLength !== null && $manifestContent !== null && strlen($manifestContent) >= $manifestLength) { + break; + } + + $stubPosition = strpos($line, ']*\?>(\r|\n)*#', '', $line); + $manifestLength = $this->resolveManifestLength($manifestContent); + // line contains start of stub + } elseif ($stubContent === null && $stubPosition !== false) { + $stubContent = substr($line, $stubPosition); + // line contains start of manifest + } elseif ($manifestContent === null && $manifestPosition !== false) { + $manifestContent = preg_replace('#^.*__HALT_COMPILER\(\)[^>]*\?>(\r|\n)*#', '', $line); + $manifestLength = $this->resolveManifestLength($manifestContent); + // manifest has been started (thus is cannot be stub anymore), add content + } elseif ($manifestContent !== null) { + $manifestContent .= $line; + $manifestLength = $this->resolveManifestLength($manifestContent); + // stub has been started (thus cannot be manifest here, yet), add content + } elseif ($stubContent !== null) { + $stubContent .= $line; + } + } + fclose($resource); + + return array( + 'stubContent' => $stubContent, + 'manifestContent' => $manifestContent, + 'manifestLength' => $manifestLength, + ); + } + + /** + * Resolves stream in order to handle compressed Phar archives. + * + * @return string + */ + private function resolveStream() + { + if ($this->fileType === 'application/x-gzip') { + return 'compress.zlib://'; + } elseif ($this->fileType === 'application/x-bzip2') { + return 'compress.bzip2://'; + } + return ''; + } + + /** + * @return string + */ + private function determineFileType() + { + $fileInfo = new \finfo(); + return $fileInfo->file($this->fileName, FILEINFO_MIME_TYPE); + } + + /** + * @param string $content + * @return int|null + */ + private function resolveManifestLength($content) + { + if (strlen($content) < 4) { + return null; + } + return static::resolveFourByteLittleEndian($content, 0); + } + + /** + * @param string $content + * @param int $start + * @return int + */ + public static function resolveFourByteLittleEndian($content, $start) + { + $payload = substr($content, $start, 4); + if (!is_string($payload)) { + throw new ReaderException( + sprintf('Cannot resolve value at offset %d', $start), + 1539614260 + ); + } + + $value = unpack('V', $payload); + if (!isset($value[1])) { + throw new ReaderException( + sprintf('Cannot resolve value at offset %d', $start), + 1539614261 + ); + } + return $value[1]; + } + + /** + * @param string $content + * @param int $start + * @return int + */ + public static function resolveTwoByteBigEndian($content, $start) + { + $payload = substr($content, $start, 2); + if (!is_string($payload)) { + throw new ReaderException( + sprintf('Cannot resolve value at offset %d', $start), + 1539614263 + ); + } + + $value = unpack('n', $payload); + if (!isset($value[1])) { + throw new ReaderException( + sprintf('Cannot resolve value at offset %d', $start), + 1539614264 + ); + } + return $value[1]; + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/ReaderException.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/ReaderException.php new file mode 100644 index 0000000000000..002afe158de6f --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Phar/ReaderException.php @@ -0,0 +1,18 @@ +content = $content; + + if ( + stripos($content, 'Phar::mapPhar(') !== false + && preg_match('#Phar\:\:mapPhar\(([^)]+)\)#', $content, $matches) + ) { + // remove spaces, single & double quotes + // @todo `'my' . 'alias' . '.phar'` is not evaluated here + $target->mappedAlias = trim($matches[1], ' \'"'); + } + + return $target; + } + + /** + * @var string + */ + private $content; + + /** + * @var string + */ + private $mappedAlias = ''; + + /** + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * @return string + */ + public function getMappedAlias() + { + return $this->mappedAlias; + } +} diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php b/libraries/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php index 5a924e4ccdf9c..b552d25dfab6d 100644 --- a/libraries/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/PharStreamWrapper.php @@ -11,6 +11,8 @@ * The TYPO3 project - inspiring people to share! */ +use TYPO3\PharStreamWrapper\Resolver\PharInvocation; + class PharStreamWrapper { /** @@ -29,6 +31,11 @@ class PharStreamWrapper */ protected $internalResource; + /** + * @var PharInvocation + */ + protected $invocation; + /** * @return bool */ @@ -409,7 +416,8 @@ public function url_stat($path, $flags) */ protected function assert($path, $command) { - if ($this->resolveAssertable()->assert($path, $command) === true) { + if (Manager::instance()->assert($path, $command) === true) { + $this->collectInvocation($path); return; } @@ -424,7 +432,22 @@ protected function assert($path, $command) } /** - * @return Assertable + * @param string $path + */ + protected function collectInvocation($path) + { + if (isset($this->invocation)) { + return; + } + + $manager = Manager::instance(); + $this->invocation = $manager->resolve($path); + $manager->getCollection()->collect($this->invocation); + } + + /** + * @return Manager|Assertable + * @deprecated Use Manager::instance() directly */ protected function resolveAssertable() { diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Resolvable.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolvable.php new file mode 100644 index 0000000000000..5d5fdc63ee1f2 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolvable.php @@ -0,0 +1,24 @@ +baseName = $baseName; + $this->alias = $alias; + } + + /** + * @return string + */ + public function __toString() + { + return $this->baseName; + } + + /** + * @return string + */ + public function getBaseName() + { + return $this->baseName; + } + + /** + * @return null|string + */ + public function getAlias() + { + return $this->alias; + } + + /** + * @param PharInvocation $other + * @return bool + */ + public function equals(PharInvocation $other) + { + return $other->baseName === $this->baseName + && $other->alias === $this->alias; + } +} \ No newline at end of file diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php new file mode 100644 index 0000000000000..d3a6ba8b298d2 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationCollection.php @@ -0,0 +1,143 @@ +getBaseName() === '' + || $invocation->getAlias() === '' + || !$this->assertUniqueBaseName($invocation, $flags) + || !$this->assertUniqueInvocation($invocation, $flags) + ) { + return false; + } + if ($flags & static::DUPLICATE_ALIAS_WARNING) { + $this->triggerDuplicateAliasWarning($invocation); + } + + $this->invocations[] = $invocation; + return true; + } + + /** + * @param callable $callback + * @param bool $reverse + * @return null|PharInvocation + */ + public function findByCallback($callback, $reverse = false) + { + foreach ($this->getInvocations($reverse) as $invocation) { + if (call_user_func($callback, $invocation) === true) { + return $invocation; + } + } + return null; + } + + /** + * Asserts that base-name is unique. This disallows having multiple invocations for + * same base-name but having different alias names. + * + * @param PharInvocation $invocation + * @param int $flags + * @return bool + */ + private function assertUniqueBaseName(PharInvocation $invocation, $flags) + { + if (!($flags & static::UNIQUE_BASE_NAME)) { + return true; + } + return $this->findByCallback( + function (PharInvocation $candidate) use ($invocation) { + return $candidate->getBaseName() === $invocation->getBaseName(); + } + ) === null; + } + + /** + * Asserts that combination of base-name and alias is unique. This allows having multiple + * invocations for same base-name but having different alias names (for whatever reason). + * + * @param PharInvocation $invocation + * @param int $flags + * @return bool + */ + private function assertUniqueInvocation(PharInvocation $invocation, $flags) + { + if (!($flags & static::UNIQUE_INVOCATION)) { + return true; + } + return $this->findByCallback( + function (PharInvocation $candidate) use ($invocation) { + return $candidate->equals($invocation); + } + ) === null; + } + + /** + * @param PharInvocation $invocation + */ + private function triggerDuplicateAliasWarning(PharInvocation $invocation) + { + $sameAliasInvocation = $this->findByCallback( + function (PharInvocation $candidate) use ($invocation) { + return $candidate->getAlias() === $invocation->getAlias(); + }, + true + ); + if ($sameAliasInvocation === null) { + return; + } + trigger_error( + sprintf( + 'Alias %s cannot be used by %s, already used by %s', + $invocation->getAlias(), + $invocation->getBaseName(), + $sameAliasInvocation->getBaseName() + ), + E_USER_WARNING + ); + } + + /** + * @param bool $reverse + * @return PharInvocation[] + */ + private function getInvocations($reverse = false) + { + if ($reverse) { + return array_reverse($this->invocations); + } + return $this->invocations; + } +} \ No newline at end of file diff --git a/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php new file mode 100644 index 0000000000000..b62b53ae319d1 --- /dev/null +++ b/libraries/vendor/typo3/phar-stream-wrapper/src/Resolver/PharInvocationResolver.php @@ -0,0 +1,137 @@ +findByAlias($path); + if ($invocation !== null && $this->assertInternalInvocation($invocation, $flags)) { + return $invocation; + } elseif ($invocation !== null) { + return null; + } + } + + $baseName = Helper::determineBaseFile($path); + if ($baseName === null) { + return null; + } + + if ($flags & static::RESOLVE_REALPATH) { + $baseName = realpath($baseName); + } + if ($flags & static::RESOLVE_ALIAS) { + $reader = new Reader($baseName); + $alias = $reader->resolveContainer()->getAlias(); + } else { + $alias = ''; + } + + return new PharInvocation($baseName, $alias); + } + + /** + * @param string $path + * @return null|PharInvocation + */ + private function findByAlias($path) + { + $normalizedPath = Helper::normalizePath($path); + $possibleAlias = strstr($normalizedPath, '/', true); + if (empty($possibleAlias)) { + return null; + } + return Manager::instance()->getCollection()->findByCallback( + function (PharInvocation $candidate) use ($possibleAlias) { + return $candidate->getAlias() === $possibleAlias; + }, + true + ); + } + + /** + * @param PharInvocation $invocation + * @param int $flags + * @return bool + * @experimental + */ + private function assertInternalInvocation(PharInvocation $invocation, $flags) + { + if (!($flags & static::ASSERT_INTERNAL_INVOCATION)) { + return true; + } + + $trace = debug_backtrace(0); + $firstIndex = count($trace) - 1; + // initial invocation, most probably a CLI tool + if (isset($trace[$firstIndex]['file']) && $trace[$firstIndex]['file'] === $invocation->getBaseName()) { + return true; + } + // otherwise search for include/require invocations + foreach ($trace as $item) { + if (!isset($item['function']) || !isset($item['args'][0])) { + continue; + } + if ($item['args'][0] === $invocation->getBaseName() + && in_array($item['function'], $this->invocationFunctionNames, true) + ) { + return true; + } + } + + return false; + } +}