Skip to content

Commit

Permalink
chore: composer update
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekutianski committed Jun 8, 2022
1 parent 7b63be1 commit 9ae12e7
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitf9ad421a8365f1ba64f3e0a3cda42a48::getLoader();
return ComposerAutoloaderInit71533684637c48b0645a8a413709c073::getLoader();
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitf9ad421a8365f1ba64f3e0a3cda42a48
class ComposerAutoloaderInit71533684637c48b0645a8a413709c073
{
private static $loader;

Expand All @@ -24,15 +24,15 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInitf9ad421a8365f1ba64f3e0a3cda42a48', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit71533684637c48b0645a8a413709c073', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitf9ad421a8365f1ba64f3e0a3cda42a48', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit71533684637c48b0645a8a413709c073', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit71533684637c48b0645a8a413709c073::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
Expand All @@ -53,12 +53,12 @@ public static function getLoader()
$loader->register(true);

if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit71533684637c48b0645a8a413709c073::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequiref9ad421a8365f1ba64f3e0a3cda42a48($fileIdentifier, $file);
composerRequire71533684637c48b0645a8a413709c073($fileIdentifier, $file);
}

return $loader;
Expand All @@ -70,7 +70,7 @@ public static function getLoader()
* @param string $file
* @return void
*/
function composerRequiref9ad421a8365f1ba64f3e0a3cda42a48($fileIdentifier, $file)
function composerRequire71533684637c48b0645a8a413709c073($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48
class ComposerStaticInit71533684637c48b0645a8a413709c073
{
public static $files = array (
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
Expand Down Expand Up @@ -144,9 +144,9 @@ class ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitf9ad421a8365f1ba64f3e0a3cda42a48::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit71533684637c48b0645a8a413709c073::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit71533684637c48b0645a8a413709c073::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit71533684637c48b0645a8a413709c073::$classMap;

}, null, ClassLoader::class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"packages": [
{
"name": "guzzlehttp/psr7",
"version": "1.8.3",
"version_normalized": "1.8.3.0",
"version": "1.8.5",
"version_normalized": "1.8.5.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85"
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"reference": "1afdd860a2566ed3c2b0b4a3de6e23434a79ec85",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/337e3ad8e5716c15f9657bd214d16cc5e69df268",
"reference": "337e3ad8e5716c15f9657bd214d16cc5e69df268",
"shasum": ""
},
"require": {
Expand All @@ -30,7 +30,7 @@
"suggest": {
"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",
"extra": {
"branch-alias": {
Expand Down Expand Up @@ -95,7 +95,7 @@
],
"support": {
"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": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<?php return array(
'root' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../../../../../../',
'aliases' => array(),
'reference' => '4c88dc60d62ac5cb8f58c56ef06d16dbdf8ab721',
'reference' => '7b63be1b79fc28ebca18aa68f3a388141cb632b6',
'name' => '__root__',
'dev' => false,
),
'versions' => array(
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
'type' => 'library',
'install_path' => __DIR__ . '/../../../../../../',
'aliases' => array(),
'reference' => '4c88dc60d62ac5cb8f58c56ef06d16dbdf8ab721',
'reference' => '7b63be1b79fc28ebca18aa68f3a388141cb632b6',
'dev_requirement' => false,
),
'guzzlehttp/psr7' => array(
'pretty_version' => '1.8.3',
'version' => '1.8.3.0',
'pretty_version' => '1.8.5',
'version' => '1.8.5.0',
'type' => 'library',
'install_path' => __DIR__ . '/../guzzlehttp/psr7',
'aliases' => array(),
'reference' => '1afdd860a2566ed3c2b0b4a3de6e23434a79ec85',
'reference' => '337e3ad8e5716c15f9657bd214d16cc5e69df268',
'dev_requirement' => false,
),
'plasticbrain/php-flash-messages' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## 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

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
},
"config": {
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,22 @@ private function setHeaders(array $headers)
}
}

/**
* @param mixed $value
*
* @return string[]
*/
private function normalizeHeaderValue($value)
{
if (!is_array($value)) {
return $this->trimHeaderValues([$value]);
return $this->trimAndValidateHeaderValues([$value]);
}

if (count($value) === 0) {
throw new \InvalidArgumentException('Header value can not be an empty array.');
}

return $this->trimHeaderValues($value);
return $this->trimAndValidateHeaderValues($value);
}

/**
Expand All @@ -178,13 +183,13 @@ private function normalizeHeaderValue($value)
* header-field = field-name ":" OWS field-value OWS
* OWS = *( SP / HTAB )
*
* @param string[] $values Header values
* @param mixed[] $values Header values
*
* @return string[] Trimmed header values
*
* @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) {
if (!is_scalar($value) && null !== $value) {
Expand All @@ -194,10 +199,20 @@ private function trimHeaderValues(array $values)
));
}

return trim((string) $value, " \t");
$trimmed = trim((string) $value, " \t");
$this->assertValue($trimmed);

return $trimmed;
}, array_values($values));
}

/**
* @see https://tools.ietf.org/html/rfc7230#section-3.2
*
* @param mixed $header
*
* @return void
*/
private function assertHeader($header)
{
if (!is_string($header)) {
Expand All @@ -210,5 +225,46 @@ private function assertHeader($header)
if ($header === '') {
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));
}
}
}

0 comments on commit 9ae12e7

Please sign in to comment.