Added
- Add
DiagnosticValue::escape()to escape controls and malformed UTF-8 in diagnostics - Add
GuzzleHttp\Psr7\Exception\TimeoutExceptionfor timed-out stream operations - Add
GuzzleHttp\Psr7\Utils::redactUserInfoInString()to redact the userinfo of a raw URI string within text - Promote
GuzzleHttp\Psr7\Rfc3986to public API withisValid*()predicates andcanonicalizeIpv6() - Add
GuzzleHttp\Psr7\UriNormalizer::CANONICALIZE_IPV6_HOSTtoPRESERVING_NORMALIZATIONS
Changed
- Require
psr/http-message:^2.0and add native parameter and return types - Require
psr/http-factory:^1.1 - Reject native PHP serialization of stream implementations
- Preserve request method casing, except
ServerRequest::fromGlobals()still uppercases - Reject empty arrays and non-string values as header values
- Reject invalid uploaded file trees and invalid parsed body values
- Reject uploaded file specs missing
tmp_name,size, orerror - Reject non-integer and negative uploaded file
errorvalues - Reject invalid stream/upload sizes, buffer high-water marks, and dropping-stream limits
- Rewind seekable uploaded-file streams before copying in
UploadedFile::moveTo() - Reject negative
read()lengths across all stream implementations - Detect the
+flag anywhere in a mode forStream::isReadable()/isWritable() - Reject empty strings returned by
PumpStreamsource callables - Discard buffered bytes on
PumpStreamclose and detach - Restore the original stream position after
Message::bodySummary() - Allow
nullfor theMessage::bodySummary()truncation length to use the default - Validate
LimitStreamoffset/limit and track non-seekable offset by bytes skipped - Make
FnStreamclose and detach terminal, calling close callbacks at most once - Suppress exceptions from
FnStreamclose callbacks during destructor cleanup - Make
CachingStream::close()idempotent, preserving remote cleanup after detach - Do not move the
CachingStreamcursor when aSEEK_ENDtarget on an unknown-size stream is rejected - Normalize multiple leading slashes in
Uri::getPath()and origin-form request targets - Serialize authority-less
fileURIs with rootless paths without the//separator - Serialize authority-less
fileURIs with empty paths asfile:instead of the unparseablefile:// - Remove dot segments above the root per RFC 3986, prefixing authority-less
//paths with/. - Return a network-path reference from
UriResolver::relativize()when an empty-path target requires one - Stop returning an empty reference from
UriResolver::relativize()when it would inherit the base fragment - Stop throwing from
UriResolver::relativize()when an equal-path target's last path segment contains a colon - Harden URI host validation (delimiters, backslashes, IPv6, embedded ports); require schemes to start with a letter
- Validate
Uri::fromParts()ports instead of casting them - Treat ports 80 and 443 as defaults for the
wsandwssschemes - Use the
wsandwssdefault ports inUriComparator::isCrossOrigin()port comparisons - Redact all non-empty URI userinfo in
Utils::redactUserInfo() - Rebuild server request URIs from
$_SERVERbyREQUEST_METHOD, using target authority beforeSERVER_PORT - Remove userinfo from absolute-form
REQUEST_URItargets inServerRequest::fromGlobals() - Reject zero-port
HTTP_HOSTand malformedSERVER_PORTinServerRequest::getUriFromGlobals() - Reject malformed
REQUEST_METHODandSERVER_PROTOCOLserver values inServerRequest::fromGlobals() - Reject zero-port
Hostand normalize leading-zero ports inMessage::parseRequest() - Reject duplicate
Hostheaders and validate present values for all request-target forms - Reject zero-port, hostless, and userinfo absolute-form request targets in
Message::parseRequest() - Synchronize the
Hostheader inRequest::withUri()when the URI changes or Host is empty - Include the URI port in
Hostheaders synthesized byMessage::toString() - Validate the Host header synthesized by
Message::toString()from the request URI - Include non-default URI ports in
Hostheaders set byUtils::modifyRequest()URI changes - Accept
OPTIONS *andCONNECTauthority-form request targets inMessage::parseRequest() - Hide credential-bearing URI, server, and cookie arguments in stack traces on PHP 8.2+
- Reject malformed HTTP request/response start-lines
- Unfold obsolete HTTP/1.0 line folding for all valid request method tokens
- Reject empty and control-character request targets in
Request::withRequestTarget() - Validate iterator chunks passed to
Utils::streamFor() - Validate unsupported values passed to
Query::build() - Reject non-finite float values in
Query::build()andMultipartStreamcontents - Reject non-finite float values in iterator chunks passed to
Utils::streamFor() Utils::streamFor()now rejects non-string scalar bodiesUri::withQueryValues()now rejects non-string values- Reject invalid
Utils::modifyRequest()change values - Use PHP debug type names in type error messages
- Changed
Utils::copyToStream()to throw when destination streams cannot make progress - Throw
TimeoutExceptionfromStreamread/write andUtilscopy/hash/readLine on stream timeouts - Throw
TimeoutExceptionfromAppendStream::read(),CachingStream::read(), andUtils::tryGetContents()on stream timeouts - Re-throw
TimeoutExceptionfromInflateStreamwhen the decoded source stream times out - Close the compressed source stream from
InflateStream::close() - Return the number of bytes copied from
Utils::copyToStream() - Throw
OverflowExceptionwhen stream byte counts or offsets exceedPHP_INT_MAX - Translate
StreamWrapperruntime failures to PHP stream failure values - Stop adding default
Content-Lengthtomultipart/form-dataparts (RFC 7578 §4.8) - Escape multipart
Content-Dispositionparameters and reject unsafe boundaries and part headers - Preserve trailing whitespace in custom
MultipartStreampart header values - Preserve explicit custom
MultipartStreamboundary'0'instead of replacing it with a generated boundary - Made static utility classes non-instantiable
- Validate bracketed IP-literal hosts consistently between parsing and
withHost(), including userinfo forms - Percent-encode raw control bytes in userinfo before bracketed IP-literal hosts instead of parsing mutated values
- Reject invalid UTF-8 and preserve percent-sequences in userinfo before bracketed IP-literal hosts
- Normalize percent-encoded octets in the URI host to uppercase hex
- Canonicalize IPv6 hosts to RFC 5952 form in
Uriconstruction,fromParts(), andwithHost() - Canonicalize bracketed IPv6 hosts in
UriComparator::isCrossOrigin() - Reject malformed percent-sequences and percent-encoded bytes forbidden by the URI host policy
- Extend
CAPITALIZE_PERCENT_ENCODINGandDECODE_UNRESERVED_CHARACTERSto userinfo and host - Trim header list elements with only spaces, horizontal tabs, and line terminators in
Header::splitList() - Report header parameter PCRE failures explicitly in
Header::parse() - Escape controls and malformed UTF-8 consistently in generated exception messages
Removed
- Dropped support for PHP 7.2 and 7.3
- Removed the
ralouphie/getallheadersdependency - Removed deprecated
Header::normalize()method