This commit is contained in:
2025-05-12 14:25:25 +02:00
parent ab2db755ef
commit 9e378ca2b7
2719 changed files with 46505 additions and 60181 deletions

View File

@@ -188,6 +188,20 @@ abstract class AbstractHeader implements HeaderInterface
$tokens[] = $encodedToken;
}
foreach ($tokens as $i => $token) {
// whitespace(s) between 2 encoded tokens
if (
0 < $i
&& isset($tokens[$i + 1])
&& preg_match('~^[\t ]+$~', $token)
&& $this->tokenNeedsEncoding($tokens[$i - 1])
&& $this->tokenNeedsEncoding($tokens[$i + 1])
) {
$tokens[$i - 1] .= $token.$tokens[$i + 1];
array_splice($tokens, $i, 2);
}
}
return $tokens;
}
@@ -237,7 +251,7 @@ abstract class AbstractHeader implements HeaderInterface
/**
* Generate a list of all tokens in the final header.
*/
protected function toTokens(string $string = null): array
protected function toTokens(?string $string = null): array
{
$string ??= $this->getBodyAsString();

View File

@@ -190,7 +190,7 @@ final class Headers
return array_shift($values);
}
public function all(string $name = null): iterable
public function all(?string $name = null): iterable
{
if (null === $name) {
foreach ($this->headers as $name => $collection) {

View File

@@ -85,7 +85,7 @@ final class ParameterizedHeader extends UnstructuredHeader
* This doesn't need to be overridden in theory, but it is for implementation
* reasons to prevent potential breakage of attributes.
*/
protected function toTokens(string $string = null): array
protected function toTokens(?string $string = null): array
{
$tokens = parent::toTokens(parent::getBodyAsString());

View File

@@ -57,6 +57,6 @@ final class PathHeader extends AbstractHeader
public function getBodyAsString(): string
{
return '<'.$this->address->toString().'>';
return '<'.$this->address->getEncodedAddress().'>';
}
}