1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Composer update.

This commit is contained in:
Cameron
2022-03-27 10:23:34 -07:00
parent 632e434711
commit f6d0164f94
10 changed files with 683 additions and 439 deletions

14
composer.lock generated
View File

@@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "1.8.3", "version": "1.8.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -98,7 +98,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.8.3" "source": "https://github.com/guzzle/psr7/tree/1.8.5"
}, },
"funding": [ "funding": [
{ {
@@ -114,7 +114,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-10-05T13:56:00+00:00" "time": "2022-03-20T21:51:18+00:00"
}, },
{ {
"name": "hybridauth/hybridauth", "name": "hybridauth/hybridauth",
@@ -643,5 +643,5 @@
"platform-overrides": { "platform-overrides": {
"php": "5.6" "php": "5.6"
}, },
"plugin-api-version": "2.0.0" "plugin-api-version": "2.2.0"
} }

View File

@@ -48,7 +48,7 @@ if (!defined('e107_INIT'))
</p> </p>
<h4 class="text-info">Sponsors</h4> <h4 class="text-info">Sponsors</h4>
<p> <p>
<a target="_blank" href="https://www.jetbrains.com/?from=e107" title="Visit JetBrains">JetBrains</a>, <a target="_blank" href="https://stemaidinstitute.com" title="Visit Stemaid Institute">Stemaid</a>.<br /> <a target="_blank" href="https://stemaidinstitute.com" title="Visit Stemaid Institute">Stemaid</a>.<br />
</p> </p>
<div class="copyright">Copyright <a target="_blank" href="https://e107.org/community" title="e107 Team">e107.org</a> 2008-'.date('Y').'.<br />Released under the terms of the GNU GPL License.</div> <div class="copyright">Copyright <a target="_blank" href="https://e107.org/community" title="e107 Team">e107.org</a> 2008-'.date('Y').'.<br />Released under the terms of the GNU GPL License.</div>
</div> </div>

View File

@@ -42,21 +42,75 @@ namespace Composer\Autoload;
*/ */
class ClassLoader class ClassLoader
{ {
/** @var ?string */
private $vendorDir;
// PSR-4 // PSR-4
/**
* @var array[]
* @psalm-var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array(); private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array(); private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array(); private $fallbackDirsPsr4 = array();
// PSR-0 // PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array(); private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array(); private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false; private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array(); private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false; private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
private $missingClasses = array(); private $missingClasses = array();
/** @var ?string */
private $apcuPrefix; private $apcuPrefix;
/**
* @var self[]
*/
private static $registeredLoaders = array();
/**
* @param ?string $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
}
/**
* @return string[]
*/
public function getPrefixes() public function getPrefixes()
{ {
if (!empty($this->prefixesPsr0)) { if (!empty($this->prefixesPsr0)) {
@@ -66,28 +120,47 @@ class ClassLoader
return array(); return array();
} }
/**
* @return array[]
* @psalm-return array<string, array<int, string>>
*/
public function getPrefixesPsr4() public function getPrefixesPsr4()
{ {
return $this->prefixDirsPsr4; return $this->prefixDirsPsr4;
} }
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs() public function getFallbackDirs()
{ {
return $this->fallbackDirsPsr0; return $this->fallbackDirsPsr0;
} }
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4() public function getFallbackDirsPsr4()
{ {
return $this->fallbackDirsPsr4; return $this->fallbackDirsPsr4;
} }
/**
* @return string[] Array of classname => path
* @psalm-return array<string, string>
*/
public function getClassMap() public function getClassMap()
{ {
return $this->classMap; return $this->classMap;
} }
/** /**
* @param array $classMap Class to filename map * @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $classMap
*
* @return void
*/ */
public function addClassMap(array $classMap) public function addClassMap(array $classMap)
{ {
@@ -102,9 +175,11 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, either * Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix. * appending or prepending to the ones previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories * @param string[]|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
*
* @return void
*/ */
public function add($prefix, $paths, $prepend = false) public function add($prefix, $paths, $prepend = false)
{ {
@@ -147,11 +222,13 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, either * Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace. * appending or prepending to the ones previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories * @param bool $prepend Whether to prepend the directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*
* @return void
*/ */
public function addPsr4($prefix, $paths, $prepend = false) public function addPsr4($prefix, $paths, $prepend = false)
{ {
@@ -195,8 +272,10 @@ class ClassLoader
* Registers a set of PSR-0 directories for a given prefix, * Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix. * replacing any others previously set for this prefix.
* *
* @param string $prefix The prefix * @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories * @param string[]|string $paths The PSR-0 base directories
*
* @return void
*/ */
public function set($prefix, $paths) public function set($prefix, $paths)
{ {
@@ -211,10 +290,12 @@ class ClassLoader
* Registers a set of PSR-4 directories for a given namespace, * Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace. * replacing any others previously set for this namespace.
* *
* @param string $prefix The prefix/namespace, with trailing '\\' * @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories * @param string[]|string $paths The PSR-4 base directories
* *
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*
* @return void
*/ */
public function setPsr4($prefix, $paths) public function setPsr4($prefix, $paths)
{ {
@@ -234,6 +315,8 @@ class ClassLoader
* Turns on searching the include path for class files. * Turns on searching the include path for class files.
* *
* @param bool $useIncludePath * @param bool $useIncludePath
*
* @return void
*/ */
public function setUseIncludePath($useIncludePath) public function setUseIncludePath($useIncludePath)
{ {
@@ -256,6 +339,8 @@ class ClassLoader
* that have not been registered with the class map. * that have not been registered with the class map.
* *
* @param bool $classMapAuthoritative * @param bool $classMapAuthoritative
*
* @return void
*/ */
public function setClassMapAuthoritative($classMapAuthoritative) public function setClassMapAuthoritative($classMapAuthoritative)
{ {
@@ -276,6 +361,8 @@ class ClassLoader
* APCu prefix to use to cache found/not-found classes, if the extension is enabled. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
* *
* @param string|null $apcuPrefix * @param string|null $apcuPrefix
*
* @return void
*/ */
public function setApcuPrefix($apcuPrefix) public function setApcuPrefix($apcuPrefix)
{ {
@@ -296,25 +383,44 @@ class ClassLoader
* Registers this instance as an autoloader. * Registers this instance as an autoloader.
* *
* @param bool $prepend Whether to prepend the autoloader or not * @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/ */
public function register($prepend = false) public function register($prepend = false)
{ {
spl_autoload_register(array($this, 'loadClass'), true, $prepend); spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
} }
/** /**
* Unregisters this instance as an autoloader. * Unregisters this instance as an autoloader.
*
* @return void
*/ */
public function unregister() public function unregister()
{ {
spl_autoload_unregister(array($this, 'loadClass')); spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
} }
/** /**
* Loads the given class or interface. * Loads the given class or interface.
* *
* @param string $class The name of the class * @param string $class The name of the class
* @return bool|null True if loaded, null otherwise * @return true|null True if loaded, null otherwise
*/ */
public function loadClass($class) public function loadClass($class)
{ {
@@ -323,6 +429,8 @@ class ClassLoader
return true; return true;
} }
return null;
} }
/** /**
@@ -367,6 +475,21 @@ class ClassLoader
return $file; return $file;
} }
/**
* Returns the currently registered loaders indexed by their corresponding vendor directories.
*
* @return self[]
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext) private function findFileWithExtension($class, $ext)
{ {
// PSR-4 lookup // PSR-4 lookup
@@ -438,6 +561,10 @@ class ClassLoader
* Scope isolated include. * Scope isolated include.
* *
* Prevents access to $this/self from included files. * Prevents access to $this/self from included files.
*
* @param string $file
* @return void
* @private
*/ */
function includeFile($file) function includeFile($file)
{ {

View File

@@ -1,307 +1,350 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer; namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*/
class InstalledVersions class InstalledVersions
{ {
private static $installed = array ( /**
'root' => * @var mixed[]|null
array ( * @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
'pretty_version' => 'dev-master', */
'version' => 'dev-master', private static $installed;
'aliases' =>
array (
),
'reference' => 'bdbc7e0daed1670296220ee5354266a41a0062cb',
'name' => 'e107inc/e107',
),
'versions' =>
array (
'e107inc/e107' =>
array (
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'aliases' =>
array (
),
'reference' => 'bdbc7e0daed1670296220ee5354266a41a0062cb',
),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '1.8.3',
'version' => '1.8.3.0',
'aliases' =>
array (
),
'reference' => '1afdd860a2566ed3c2b0b4a3de6e23434a79ec85',
),
'hybridauth/hybridauth' =>
array (
'pretty_version' => '3.7.1',
'version' => '3.7.1.0',
'aliases' =>
array (
),
'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316',
),
'ifsnop/mysqldump-php' =>
array (
'pretty_version' => 'v2.9',
'version' => '2.9.0.0',
'aliases' =>
array (
),
'reference' => 'fc9c119fe5d70af9a685cad6a8ac612fd7589e25',
),
'intervention/image' =>
array (
'pretty_version' => '2.7.1',
'version' => '2.7.1.0',
'aliases' =>
array (
),
'reference' => '744ebba495319501b873a4e48787759c72e3fb8c',
),
'matthiasmullie/minify' =>
array (
'pretty_version' => '1.3.66',
'version' => '1.3.66.0',
'aliases' =>
array (
),
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
),
'matthiasmullie/path-converter' =>
array (
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'aliases' =>
array (
),
'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9',
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0',
'aliases' =>
array (
),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
),
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
),
);
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
public static function getInstalledPackages() foreach (self::getInstalled() as $installed) {
{ foreach ($installed['versions'] as $name => $package) {
return array_keys(self::$installed['versions']); if (isset($package['type']) && $package['type'] === $type) {
} $packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
public static function isInstalled($packageName) *
{ * This also returns true if the package name is provided or replaced by another package
return isset(self::$installed['versions'][$packageName]); *
} * @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
}
}
return false;
}
public static function satisfies(VersionParser $parser, $packageName, $constraint) /**
{ * Checks whether the given package satisfies a version constraint
$constraint = $parser->parseConstraints($constraint); *
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
return $provided->matches($constraint); * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
} *
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints($constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
public static function getVersionRanges($packageName) return $provided->matches($constraint);
{ }
if (!isset(self::$installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); /**
} * Returns a version constraint representing all the range(s) which are installed for a given package
*
$ranges = array(); * It is easier to use this via isInstalled() with the $constraint argument if you need to check
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) { * whether a given version of a package is installed, and not just whether it exists
$ranges[] = self::$installed['versions'][$packageName]['pretty_version']; *
} * @param string $packageName
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) { * @return string Version constraint usable with composer/semver
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']); */
} public static function getVersionRanges($packageName)
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) { {
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']); foreach (self::getInstalled() as $installed) {
} if (!isset($installed['versions'][$packageName])) {
if (array_key_exists('provided', self::$installed['versions'][$packageName])) { continue;
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']); }
}
$ranges = array();
return implode(' || ', $ranges); if (isset($installed['versions'][$packageName]['pretty_version'])) {
} $ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
public static function getVersion($packageName) $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
{ }
if (!isset(self::$installed['versions'][$packageName])) { if (array_key_exists('provided', $installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
} }
if (!isset(self::$installed['versions'][$packageName]['version'])) { return implode(' || ', $ranges);
return null; }
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
return self::$installed['versions'][$packageName]['version']; }
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
public static function getPrettyVersion($packageName) {
{ foreach (self::getInstalled() as $installed) {
if (!isset(self::$installed['versions'][$packageName])) { if (!isset($installed['versions'][$packageName])) {
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); continue;
} }
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) { if (!isset($installed['versions'][$packageName]['version'])) {
return null; return null;
} }
return self::$installed['versions'][$packageName]['pretty_version']; return $installed['versions'][$packageName]['version'];
} }
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
public static function getReference($packageName) * @param string $packageName
{ * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
if (!isset(self::$installed['versions'][$packageName])) { */
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); public static function getPrettyVersion($packageName)
} {
foreach (self::getInstalled() as $installed) {
if (!isset(self::$installed['versions'][$packageName]['reference'])) { if (!isset($installed['versions'][$packageName])) {
return null; continue;
} }
return self::$installed['versions'][$packageName]['reference']; if (!isset($installed['versions'][$packageName]['pretty_version'])) {
} return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
public static function getRootPackage() throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
{ }
return self::$installed['root'];
} /**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
public static function getRawData() continue;
{ }
return self::$installed;
} if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
public static function reload($data)
{ return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
self::$installed = $data; }
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
$installed[] = self::$installed;
return $installed;
}
} }

View File

@@ -23,7 +23,7 @@ class ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae
} }
spl_autoload_register(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
@@ -63,11 +63,16 @@ class ComposerAutoloaderInit4ce406ae486ac58c9aa71537459207ae
} }
} }
/**
* @param string $fileIdentifier
* @param string $file
* @return void
*/
function composerRequire4ce406ae486ac58c9aa71537459207ae($fileIdentifier, $file) function composerRequire4ce406ae486ac58c9aa71537459207ae($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
} }
} }

View File

@@ -2,17 +2,17 @@
"packages": [ "packages": [
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "1.8.3", "version": "1.8.5",
"version_normalized": "1.8.3.0", "version_normalized": "1.8.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85" "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85", "reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -30,7 +30,7 @@
"suggest": { "suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
}, },
"time": "2021-10-05T13:56:00+00:00", "time": "2022-03-20T21:51:18+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@@ -39,12 +39,12 @@
}, },
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [ "files": [
"src/functions_include.php" "src/functions_include.php"
] ],
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
}
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
@@ -95,7 +95,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/1.8.3" "source": "https://github.com/guzzle/psr7/tree/1.8.5"
}, },
"funding": [ "funding": [
{ {

View File

@@ -1,112 +1,110 @@
<?php return array ( <?php return array(
'root' => 'root' => array(
array ( 'pretty_version' => 'dev-master',
'pretty_version' => 'dev-master', 'version' => 'dev-master',
'version' => 'dev-master', 'type' => 'project',
'aliases' => 'install_path' => __DIR__ . '/../../../',
array ( 'aliases' => array(),
'reference' => '632e4347113022b465bb280b46f2c1afbd16becc',
'name' => 'e107inc/e107',
'dev' => true,
), ),
'reference' => 'bdbc7e0daed1670296220ee5354266a41a0062cb', 'versions' => array(
'name' => 'e107inc/e107', 'e107inc/e107' => array(
), 'pretty_version' => 'dev-master',
'versions' => 'version' => 'dev-master',
array ( 'type' => 'project',
'e107inc/e107' => 'install_path' => __DIR__ . '/../../../',
array ( 'aliases' => array(),
'pretty_version' => 'dev-master', 'reference' => '632e4347113022b465bb280b46f2c1afbd16becc',
'version' => 'dev-master', 'dev_requirement' => false,
'aliases' => ),
array ( 'guzzlehttp/psr7' => array(
), 'pretty_version' => '1.8.5',
'reference' => 'bdbc7e0daed1670296220ee5354266a41a0062cb', 'version' => '1.8.5.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => '337e3ad8e5716c15f9657bd214d16cc5e69df268',
'dev_requirement' => false,
),
'hybridauth/hybridauth' => array(
'pretty_version' => '3.7.1',
'version' => '3.7.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../hybridauth/hybridauth',
'aliases' => array(),
'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316',
'dev_requirement' => false,
),
'ifsnop/mysqldump-php' => array(
'pretty_version' => 'v2.9',
'version' => '2.9.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ifsnop/mysqldump-php',
'aliases' => array(),
'reference' => 'fc9c119fe5d70af9a685cad6a8ac612fd7589e25',
'dev_requirement' => false,
),
'intervention/image' => array(
'pretty_version' => '2.7.1',
'version' => '2.7.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../intervention/image',
'aliases' => array(),
'reference' => '744ebba495319501b873a4e48787759c72e3fb8c',
'dev_requirement' => false,
),
'matthiasmullie/minify' => array(
'pretty_version' => '1.3.66',
'version' => '1.3.66.0',
'type' => 'library',
'install_path' => __DIR__ . '/../matthiasmullie/minify',
'aliases' => array(),
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
'dev_requirement' => false,
),
'matthiasmullie/path-converter' => array(
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../matthiasmullie/path-converter',
'aliases' => array(),
'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9',
'dev_requirement' => false,
),
'phpmailer/phpmailer' => array(
'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0',
'type' => 'library',
'install_path' => __DIR__ . '/../phpmailer/phpmailer',
'aliases' => array(),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
'dev_requirement' => false,
),
'psr/http-message' => array(
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
'dev_requirement' => false,
),
'psr/http-message-implementation' => array(
'dev_requirement' => false,
'provided' => array(
0 => '1.0',
),
),
'ralouphie/getallheaders' => array(
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'type' => 'library',
'install_path' => __DIR__ . '/../ralouphie/getallheaders',
'aliases' => array(),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
'dev_requirement' => false,
),
), ),
'guzzlehttp/psr7' =>
array (
'pretty_version' => '1.8.3',
'version' => '1.8.3.0',
'aliases' =>
array (
),
'reference' => '1afdd860a2566ed3c2b0b4a3de6e23434a79ec85',
),
'hybridauth/hybridauth' =>
array (
'pretty_version' => '3.7.1',
'version' => '3.7.1.0',
'aliases' =>
array (
),
'reference' => '0ec1b8cb8b230aae739422c5e42bc5733b3a7316',
),
'ifsnop/mysqldump-php' =>
array (
'pretty_version' => 'v2.9',
'version' => '2.9.0.0',
'aliases' =>
array (
),
'reference' => 'fc9c119fe5d70af9a685cad6a8ac612fd7589e25',
),
'intervention/image' =>
array (
'pretty_version' => '2.7.1',
'version' => '2.7.1.0',
'aliases' =>
array (
),
'reference' => '744ebba495319501b873a4e48787759c72e3fb8c',
),
'matthiasmullie/minify' =>
array (
'pretty_version' => '1.3.66',
'version' => '1.3.66.0',
'aliases' =>
array (
),
'reference' => '45fd3b0f1dfa2c965857c6d4a470bea52adc31a6',
),
'matthiasmullie/path-converter' =>
array (
'pretty_version' => '1.1.3',
'version' => '1.1.3.0',
'aliases' =>
array (
),
'reference' => 'e7d13b2c7e2f2268e1424aaed02085518afa02d9',
),
'phpmailer/phpmailer' =>
array (
'pretty_version' => 'v6.6.0',
'version' => '6.6.0.0',
'aliases' =>
array (
),
'reference' => 'e43bac82edc26ca04b36143a48bde1c051cfd5b1',
),
'psr/http-message' =>
array (
'pretty_version' => '1.0.1',
'version' => '1.0.1.0',
'aliases' =>
array (
),
'reference' => 'f6561bf28d520154e4b0ec72be95418abe6d9363',
),
'psr/http-message-implementation' =>
array (
'provided' =>
array (
0 => '1.0',
),
),
'ralouphie/getallheaders' =>
array (
'pretty_version' => '3.0.3',
'version' => '3.0.3.0',
'aliases' =>
array (
),
'reference' => '120b605dfeb996808c31b6477290a714d356e822',
),
),
); );

View File

@@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## Unreleased ## Unreleased
## 1.8.5 - 2022-03-20
### Fixed
- Correct header value validation
## 1.8.4 - 2022-03-20
### Fixed
- Validate header values properly
## 1.8.3 - 2021-10-05 ## 1.8.3 - 2021-10-05
### Fixed ### Fixed

View File

@@ -68,6 +68,9 @@
}, },
"config": { "config": {
"preferred-install": "dist", "preferred-install": "dist",
"sort-packages": true "sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
} }
} }

View File

@@ -157,17 +157,22 @@ trait MessageTrait
} }
} }
/**
* @param mixed $value
*
* @return string[]
*/
private function normalizeHeaderValue($value) private function normalizeHeaderValue($value)
{ {
if (!is_array($value)) { if (!is_array($value)) {
return $this->trimHeaderValues([$value]); return $this->trimAndValidateHeaderValues([$value]);
} }
if (count($value) === 0) { if (count($value) === 0) {
throw new \InvalidArgumentException('Header value can not be an empty array.'); throw new \InvalidArgumentException('Header value can not be an empty array.');
} }
return $this->trimHeaderValues($value); return $this->trimAndValidateHeaderValues($value);
} }
/** /**
@@ -178,13 +183,13 @@ trait MessageTrait
* header-field = field-name ":" OWS field-value OWS * header-field = field-name ":" OWS field-value OWS
* OWS = *( SP / HTAB ) * OWS = *( SP / HTAB )
* *
* @param string[] $values Header values * @param mixed[] $values Header values
* *
* @return string[] Trimmed header values * @return string[] Trimmed header values
* *
* @see https://tools.ietf.org/html/rfc7230#section-3.2.4 * @see https://tools.ietf.org/html/rfc7230#section-3.2.4
*/ */
private function trimHeaderValues(array $values) private function trimAndValidateHeaderValues(array $values)
{ {
return array_map(function ($value) { return array_map(function ($value) {
if (!is_scalar($value) && null !== $value) { if (!is_scalar($value) && null !== $value) {
@@ -194,10 +199,20 @@ trait MessageTrait
)); ));
} }
return trim((string) $value, " \t"); $trimmed = trim((string) $value, " \t");
$this->assertValue($trimmed);
return $trimmed;
}, array_values($values)); }, array_values($values));
} }
/**
* @see https://tools.ietf.org/html/rfc7230#section-3.2
*
* @param mixed $header
*
* @return void
*/
private function assertHeader($header) private function assertHeader($header)
{ {
if (!is_string($header)) { if (!is_string($header)) {
@@ -210,5 +225,46 @@ trait MessageTrait
if ($header === '') { if ($header === '') {
throw new \InvalidArgumentException('Header name can not be empty.'); throw new \InvalidArgumentException('Header name can not be empty.');
} }
if (! preg_match('/^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$/', $header)) {
throw new \InvalidArgumentException(
sprintf(
'"%s" is not valid header name',
$header
)
);
}
}
/**
* @param string $value
*
* @return void
*
* @see https://tools.ietf.org/html/rfc7230#section-3.2
*
* field-value = *( field-content / obs-fold )
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
* field-vchar = VCHAR / obs-text
* VCHAR = %x21-7E
* obs-text = %x80-FF
* obs-fold = CRLF 1*( SP / HTAB )
*/
private function assertValue($value)
{
// The regular expression intentionally does not support the obs-fold production, because as
// per RFC 7230#3.2.4:
//
// A sender MUST NOT generate a message that includes
// line folding (i.e., that has any field-value that contains a match to
// the obs-fold rule) unless the message is intended for packaging
// within the message/http media type.
//
// Clients must not send a request with line folding and a server sending folded headers is
// likely very rare. Line folding is a fairly obscure feature of HTTP/1.1 and thus not accepting
// folding is not likely to break any legitimate use case.
if (! preg_match('/^[\x20\x09\x21-\x7E\x80-\xFF]*$/', $value)) {
throw new \InvalidArgumentException(sprintf('"%s" is not valid header value', $value));
}
} }
} }