Releases: zendframework/zend-diactoros
zend-diactoros 2.0.2
Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #344 provides a fix to ensure that headers with a value of "0" are retained.
zend-diactoros 2.0.1
Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #337 ensures that the
ServerRequestFactory::createServerRequest()method
creates aphp://tempstream instead of aphp::inputstream, in compliance
with the PSR-17 specification.
zend-diactoros 2.0.0
Added
-
#326 adds PSR-17 HTTP Message Factory implementations, including:
Zend\Diactoros\RequestFactoryZend\Diactoros\ResponseFactoryZend\Diactoros\ServerRequestFactoryZend\Diactoros\StreamFactoryZend\Diactoros\UploadedFileFactoryZend\Diactoros\UriFactory
These factories may be used to produce the associated instances; we encourage
users to rely on the PSR-17 factory interfaces to allow exchanging PSR-7
implementations within their applications. -
#328 adds a package-level exception interface,
Zend\Diactoros\Exception\ExceptionInterface,
and several implementations for specific exceptions raised within the package.
These include:Zend\Diactoros\Exception\DeserializationException(extendsUnexpectedValueException)Zend\Diactoros\Exception\InvalidArgumentException(extendsInvalidArgumentException)Zend\Diactoros\Exception\InvalidStreamPointerPositionException(extendsRuntimeException)Zend\Diactoros\Exception\SerializationException(extendsUnexpectedValueException)Zend\Diactoros\Exception\UnreadableStreamException(extendsRuntimeException)Zend\Diactoros\Exception\UnrecognizedProtocolVersionException(extendsUnexpectedValueException)Zend\Diactoros\Exception\UnrewindableStreamException(extendsRuntimeException)Zend\Diactoros\Exception\UnseekableStreamException(extendsRuntimeException)Zend\Diactoros\Exception\UntellableStreamException(extendsRuntimeException)Zend\Diactoros\Exception\UnwritableStreamException(extendsRuntimeException)Zend\Diactoros\Exception\UploadedFileAlreadyMovedException(extendsRuntimeException)Zend\Diactoros\Exception\UploadedFileErrorException(extendsRuntimeException)
Changed
-
#329 adds return type hints and scalar parameter type hints wherever possible.
The changes were done to help improve code quality, in part by reducing manual
type checking. If you are extending any classes, you may need to update your
signatures; check the signatures of the class(es) you are extending for changes. -
#162 modifies
Serializer\Requestsuch that it now no longer raises anUnexpectedValueExceptionvia itstoString()method
when an unexpected HTTP method is encountered; this can be done safely, as the value can never
be invalid due to other changes in the same patch. -
#162 modifies
RequestTraitsuch that it now invalidates non-string method arguments to either
the constructor orwithMethod(), raising anInvalidArgumentExceptionfor any that do not validate.
Deprecated
- Nothing.
Removed
-
#308 removes the following methods from the
ServerRequestFactoryclass:normalizeServer()(useZend\Diactoros\normalizeServer()instead)marshalHeaders()(useZend\Diactoros\marshalHeadersFromSapi()instead)marshalUriFromServer()(useZend\Diactoros\marshalUriFromSapi()instead)marshalRequestUri()(useUri::getPath()from theUriinstance returned bymarshalUriFromSapi()instead)marshalHostAndPortFromHeaders()(useUri::getHost()andUri::getPort()from theUriinstances returned bymarshalUriFromSapi()instead)stripQueryString()(useexplode("?", $path, 2)[0]instead)normalizeFiles()(useZend\Diactoros\normalizeUploadedFiles()instead)
-
#295 removes
Zend\Diactoros\Server. You can use theRequestHandlerRunnerclass from
zendframework/zend-httphandlerrunner to provide these capabilities instead. -
#295 removes
Zend\Diactoros\Response\EmitterInterfaceand the various emitter implementations.
These can now be found in the package zendframework/zend-httphandlerrunner, which also provides
a PSR-7-implementation agnostic way of using them.
Fixed
- Nothing.
zend-diactoros 1.8.6
Added
- Nothing.
Changed
-
#325 changes the behavior of
ServerRequest::withParsedBody(). Per
PSR-7, it now no longer allows values other thannull, arrays, or objects. -
#325 changes the behavior of each of
Request,ServerRequest, and
Responsein relation to the validation of header values. Previously, we
allowed empty arrays to be provided viawithHeader(); however, this was
contrary to the PSR-7 specification. Empty arrays are no longer allowed.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
zend-diactoros 1.8.5
Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #324 fixes a reference
to an undefined variable in theServerRequestFactory, which made it
impossible to fetch a specific header by name.
zend-diactoros 1.8.4
Added
- Nothing.
Changed
-
This release modifies how
ServerRequestFactorymarshals the request URI. In
prior releases, we would attempt to inspect theX-Rewrite-Urland
X-Original-Urlheaders, using their values, if present. These headers are
issued by the ISAPI_Rewrite module for IIS (developed by HeliconTech).
However, we have no way of guaranteeing that the module is what issued the
headers, making it an unreliable source for discovering the URI. As such, we
have removed this feature in this release of Diactoros.If you are developing a middleware application, you can mimic the
functionality via middleware as follows:use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; use Zend\Diactoros\Uri; public function process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface { $requestUri = null; $httpXRewriteUrl = $request->getHeaderLine('X-Rewrite-Url'); if ($httpXRewriteUrl !== null) { $requestUri = $httpXRewriteUrl; } $httpXOriginalUrl = $request->getHeaderLine('X-Original-Url'); if ($httpXOriginalUrl !== null) { $requestUri = $httpXOriginalUrl; } if ($requestUri !== null) { $request = $request->withUri(new Uri($requestUri)); } return $handler->handle($request); }
If you use middleware such as the above, make sure you also instruct your web
server to strip any incoming headers of the same name so that you can
guarantee they are issued by the ISAPI_Rewrite module.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
zend-diactoros 1.8.3
Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#321 updates the logic in
Uri::withPort()to ensure that it checks that the
value provided is either an integer or a string integer, as only those values
may be cast to integer without data loss. -
#320 adds checking within
Responseto ensure that the provided reason
phrase is a string; anInvalidArgumentExceptionis now raised if it is not. This change
ensures the class adheres strictly to the PSR-7 specification. -
#319 provides a fix to
Zend\Diactoros\Responsethat ensures that the status
code returned is always an integer (and never a string containing an
integer), thus ensuring it strictly adheres to the PSR-7 specification.
zend-diactoros 1.8.2
Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#318 fixes the logic for discovering whether an HTTPS scheme is in play
to be case insensitive when comparing header and SAPI values, ensuring no
false negative lookups occur. -
#314 modifies error handling around opening a file resource within
Zend\Diactoros\Stream::setStream()to no longer use the second argument to
set_error_handler(), and instead check the error type in the handler itself;
this fixes an issue when the handler is nested inside another error handler,
which currently has buggy behavior within the PHP engine.
zend-diactoros 1.8.1
Added
- Nothing.
Changed
- #313 changes the reason phrase associated with the status code 425
to "Too Early", corresponding to a new definition of the code as specified by the IANA.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #312 fixes how the
normalizeUploadedFiles()utility function handles nested trees of
uploaded files, ensuring it detects them properly.
zend-diactoros 1.8.0
Added
- #307 adds the following functions under the
Zend\Diactorosnamespace, each of
which may be used to derive artifacts from SAPI supergloabls for the purposes
of generating aServerRequestinstance:normalizeServer(array $server, callable $apacheRequestHeaderCallback = null) : array
(main purpose is to aggregate theAuthorizationheader in the SAPI params
when under Apache)marshalProtocolVersionFromSapi(array $server) : stringmarshalMethodFromSapi(array $server) : stringmarshalUriFromSapi(array $server, array $headers) : UrimarshalHeadersFromSapi(array $server) : arrayparseCookieHeader(string $header) : arraycreateUploadedFile(array $spec) : UploadedFile(creates the instance from
a normal$_FILESentry)normalizeUploadedFiles(array $files) : UploadedFileInterface[](traverses
a potentially nested array of uploaded file instances and/or$_FILES
entries, including those aggregated under mod_php, php-fpm, and php-cgi in
order to create a flat array ofUploadedFileInterfaceinstances to use in a
request)
Changed
- Nothing.
Deprecated
-
#307 deprecates
ServerRequestFactory::normalizeServer(); the method is
no longer used internally, and users should instead useZend\Diactoros\normalizeServer(),
to which it proxies. -
#307 deprecates
ServerRequestFactory::marshalHeaders(); the method is
no longer used internally, and users should instead useZend\Diactoros\marshalHeadersFromSapi(),
to which it proxies. -
#307 deprecates
ServerRequestFactory::marshalUriFromServer(); the method
is no longer used internally. Users should usemarshalUriFromSapi()instead. -
#307 deprecates
ServerRequestFactory::marshalRequestUri(). the method is no longer
used internally, and currently proxies tomarshalUriFromSapi(), pulling the
discovered path from theUriinstance returned by that function. Users
should usemarshalUriFromSapi()instead. -
#307 deprecates
ServerRequestFactory::marshalHostAndPortFromHeaders(); the method
is no longer used internally, and currently proxies tomarshalUriFromSapi(),
pulling the discovered host and port from theUriinstance returned by that
function. Users should usemarshalUriFromSapi()instead. -
#307 deprecates
ServerRequestFactory::getHeader(); the method is no longer
used internally. Users should copy and paste the functionality into their own
applications if needed, or rely on headers from a fully-populatedUri
instance instead. -
#307 deprecates
ServerRequestFactory::stripQueryString(); the method is no longer
used internally, and users can mimic the functionality via the expression
$path = explode('?', $path, 2)[0];. -
#307 deprecates
ServerRequestFactory::normalizeFiles(); the functionality
is no longer used internally, and users can usenormalizeUploadedFiles()as
a replacement. -
#303 deprecates
Zend\Diactoros\Response\EmitterInterfaceand its various implementations. These are now provided via the
zendframework/zend-httphandlerrunner package as 1:1 substitutions. -
#303 deprecates the
Zend\Diactoros\Serverclass. Users are directed to theRequestHandlerRunnerclass from the
zendframework/zend-httphandlerrunner package as an alternative.
Removed
- Nothing.
Fixed
- Nothing.