This commit is contained in:
1 parent
f7c532a648
commit
640bd67556
5801 files changed
+484532
-55857
No files matched your search
+4
-4
@@ -19,7 +19,7 @@ final class QpContentEncoder implements ContentEncoderInterface
|
||||
public function encodeByteStream($stream, int $maxLineLength = 0): iterable
|
||||
{
|
||||
if (!\is_resource($stream)) {
|
||||
throw new \TypeError(sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
|
||||
throw new \TypeError(\sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
|
||||
}
|
||||
|
||||
// we don't use PHP stream filters here as the content should be small enough
|
||||
@@ -46,9 +46,9 @@ final class QpContentEncoder implements ContentEncoderInterface
|
||||
// transform =0D=0A to CRLF
|
||||
$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'], ["=09\r\n", "=20\r\n", "\r\n"], $string);
|
||||
|
||||
return match (\ord(substr($string, -1))) {
|
||||
0x09 => substr_replace($string, '=09', -1),
|
||||
0x20 => substr_replace($string, '=20', -1),
|
||||
return match ($string[-1] ?? '') {
|
||||
"\x09" => substr_replace($string, '=09', -1),
|
||||
"\x20" => substr_replace($string, '=20', -1),
|
||||
default => $string,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user