zendframework/zend-diactoros
Abandoned; use laminas/laminas-diactoros. PSR HTTP Message implementations
2.2.1
78M downloads/mo
#1510 most downloaded on Packagist
zendframework/zend-diactoros
What this package is like to depend on
Last release 7 years ago
no release in 18 months
Release timing varies
gaps range from 9 days to 4 months
Nearly every release is documented
notes for 53 of 53 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
53 releases · first in 2015
0 releases in the last 12 months
see the full history below
Release timeline
53 releases · May 2015 to Nov 2019Releases
latest 53-
2.2.113 Nov 2019Release notes
Open source →Added
- Nothing.
Changed
- #379 removes extension of
SplFileInfoby theUploadedFileclass. The signatures ofgetSize()are potentially incompatible, andUploadedFileis intended to work with arbitrary PHP and PSR-7 streams, whereasSplFileInfocan only model files on the filesystem. While this is technically a BC break, we are treating it as a bugfix, as the class was broken for many use cases.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Release notes
Open source →Added
- Nothing.
Changed
- #379 removes extension of
SplFileInfoby theUploadedFileclass. The signatures ofgetSize()are potentially incompatible, andUploadedFileis intended to work with arbitrary PHP and PSR-7 streams, whereasSplFileInfocan only model files on the filesystem. While this is technically a BC break, we are treating it as a bugfix, as the class was broken for many use cases.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
2.2.012 Nov 2019Release notes
Open source →Added
- #376 adds support for using the X-Forwarded-Host header for determining the originally requested host name when marshaling the server request.
Changed
- #378 updates the
UploadedFileclass to extendSplFileInfo, allowing developers to make use of those features in their applications.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Release notes
Open source →Added
- #376 adds support for using the X-Forwarded-Host header for determining the originally requested host name when marshaling the server request.
Changed
- #378 updates the
UploadedFileclass to extendSplFileInfo, allowing developers to make use of those features in their applications.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
2.1.510 Oct 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #372 fixes issues that occur in the
Zend\Diactoros\Uriclass when invalid UTF-8 characters are present the user-info, path, or query string, ensuring they are URL-encoded before being consumed. Previously, such characters could result in a fatal error, which was particularly problematic when marshaling the request URI for an application request cycle.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #372 fixes issues that occur in the
Zend\Diactoros\Uriclass when invalid UTF-8 characters are present the user-info, path, or query string, ensuring they are URL-encoded before being consumed. Previously, such characters could result in a fatal error, which was particularly problematic when marshaling the request URI for an application request cycle.
-
2.1.408 Oct 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#370 updates
Zend\Diactoros\marshalHeadersFromSapi()to ensure all underscores in header name keys are converted to dashes (fixing issues with header names such asCONTENT_SECURITY_POLICY, which would previously resolve improperly tocontent-security_policy). -
#370 updates
Zend\Diactoros\marshalHeadersFromSapi()to ignore header names from the$serverarray that resolve to integers; previously, it would raise a fatal error.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
#370 updates
Zend\Diactoros\marshalHeadersFromSapi()to ensure all underscores in header name keys are converted to dashes (fixing issues with header names such asCONTENT_SECURITY_POLICY, which would previously resolve improperly tocontent-security_policy). -
#370 updates
Zend\Diactoros\marshalHeadersFromSapi()to ignore header names from the$serverarray that resolve to integers; previously, it would raise a fatal error.
-
2.1.310 Jul 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #363 modifies detection of HTTPS schemas via the
$_SERVER['HTTPS']value
such that an empty HTTPS-key will result in a scheme ofhttpand not
https.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #363 modifies detection of HTTPS schemas via the
$_SERVER['HTTPS']value such that an empty HTTPS-key will result in a scheme ofhttpand nothttps.
-
2.1.229 Apr 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #355 adds
phpdbgto the list of accepted non-SAPI enviornments for purposes
of callingUploadedFile::moveTo().
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #355 adds
phpdbgto the list of accepted non-SAPI enviornments for purposes of callingUploadedFile::moveTo().
-
2.1.105 Jan 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #349 fixes an issue when marshaling headers with values of
0or0from the SAPI, ensuring they are detected and injected into the ServerRequest properly.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #349 fixes an issue when marshaling headers with values of
0or0from the SAPI, ensuring they are detected and injected into the ServerRequest properly.
-
2.1.020 Dec 2018Release notes
Open source →Added
- #345 adds support for PHP 7.3.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
Release notes
Open source →Added
- #345 adds support for PHP 7.3.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
2.0.305 Jan 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #349 fixes an issue when marshaling headers with values of
0or0from the
SAPI, ensuring they are detected and injected into the ServerRequest properly.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #349 fixes an issue when marshaling headers with values of
0or0from the SAPI, ensuring they are detected and injected into the ServerRequest properly.
-
2.0.220 Dec 2018Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #344 provides a fix to ensure that headers with a value of "0" are retained.
-
2.0.103 Dec 2018Release notes
Open source →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.
-
2.0.027 Sep 2018Release notes
Open source →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.
-
-
1.8.706 Aug 2019Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #364 modifies detection of HTTPS schemas via the
$_SERVER['HTTPS']value such that an empty HTTPS-key will result in a scheme ofhttpand nothttps.
Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #364 modifies detection of HTTPS schemas via the
$_SERVER['HTTPS']value such that an empty HTTPS-key will result in a scheme ofhttpand nothttps.
-
1.8.605 Sep 2018Release notes
Open source →Added
- Nothing.
Changed
-
#325 changes the behavior of
ServerRequest::withParsedBody(). Per -
PSR-7, it now no longer allows values other than
null, arrays, or objects. -
#325 changes the behavior of each of
Request,ServerRequest, andResponsein 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
-
1.8.510 Aug 2018Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #324 fixes a reference
to an undefined variable in the
ServerRequestFactory, which made it impossible to fetch a specific header by name.
-
1.8.401 Aug 2018Release notes
Open source →Added
- Nothing.
Changed
-
This release modifies how
ServerRequestFactorymarshals the request URI. In prior releases, we would attempt to inspect theX-Rewrite-UrlandX-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.
-
1.8.324 Jul 2018Release notes
Open source →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.
-
1.8.219 Jul 2018Release notes
Open source →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 toset_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.
-
1.8.109 Jul 2018Release notes
Open source →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.
-
1.8.027 Jun 2018Release notes
Open source →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$_FILESentries, 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-populatedUriinstance 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.
- #307 adds the following functions under the
-
1.7.229 May 2018Release notes
Open source →Added
- Nothing.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #301 adds stricter comparisons within the
uriclass to ensure non-empty values are not treated as empty.
-
1.7.126 Feb 2018Release notes
Open source →Added
- Nothing.
Changed
- #293 updates
Uri::getHost()to cast the value viastrtolower()before returning it. While this represents a change, it is fixing a bug in our implementation: the PSR-7 specification for the method, which follows IETF RFC 3986 section 3.2.2, requires that the host name be normalized to lowercase.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #290 fixes
Stream::getSize()such that it checks that the result offstatwas succesful before attempting to return itssizemember; in the case of an error, it now returnsnull.
-
1.7.004 Jan 2018Release notes
Open source →Added
-
#285 adds a new custom response type,
Zend\Diactoros\Response\XmlResponse, for generating responses representing XML. Usage is the same as with theHtmlResponseorTextResponse; the response generated will have aContent-Type: application/xmlheader by default. -
#280 adds the response status code/phrase pairing "103 Early Hints" to the
Response::$phrasesproperty. This is a new status proposed via RFC 8297. -
#279 adds explicit support for PHP 7.2; previously, we'd allowed build failures, though none occured; we now require PHP 7.2 builds to pass.
Changed
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
-
1.6.112 Oct 2017Release notes
Open source →Added
- Nothing.
Changed
- #273 updates each of the SAPI emitter implementations to emit the status line after emitting other headers; this is done to ensure that the status line is not overridden by PHP.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #273 modifies how
the
SapiEmitterTraitcallsheader()to ensure that a response code is always passed as the third argument; this is done to prevent PHP from silently overriding it.
-
1.6.013 Sep 2017Release notes
Open source →Added
- Nothing.
Changed
-
#270 changes the behavior of
Zend\Diactoros\Server: it no longer creates an output buffer. -
#270 changes the behavior of the two SAPI emitters in two backwards-incompatible ways:
-
They no longer auto-inject a
Content-Lengthheader. If you need this functionality, zendframework/zend-expressive-helpers 4.1+ provides it viaZend\Expressive\Helper\ContentLengthMiddleware. -
They no longer flush the output buffer. Instead, if headers have been sent, or the output buffer exists and has a non-zero length, the emitters raise an exception, as mixed PSR-7/output buffer content creates a blocking issue. If you are emitting content via
echo,print,var_dump, etc., or not catching PHP errors or exceptions, you will need to either fix your application to always work with a PSR-7 response, or provide your own emitters that allow mixed output mechanisms.
-
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
1.5.022 Aug 2017Release notes
Open source →Added
-
#205 adds support for PHP 7.2.
-
#250 adds a new API to
JsonResponseto avoid the need for decoding the response body in order to make changes to the underlying content. New methods include:getPayload(): retrieve the unencoded payload.withPayload($data): create a new instance with the given data.getEncodingOptions(): retrieve the flags to use when encoding the payload to JSON.withEncodingOptions(int $encodingOptions): create a new instance that uses the provided flags when encoding the payload to JSON.
Changed
-
#249 changes the behavior of the various
Uri::with*()methods slightly: if the value represents no change, these methods will return the same instance instead of a new one. -
#248 changes the behavior of
Uri::getUserInfo()slightly: it now (correctly) returns the percent-encoded values for the user and/or password, per RFC 3986 Section 3.2.1.withUserInfo()will percent-encode values, using a mechanism that prevents double-encoding. -
#243 changes the exception messages thrown by
UploadedFile::getStream()andmoveTo()when an upload error exists to include details about the upload error. -
#233 adds a new argument to
SapiStreamEmitter::emit,$maxBufferLevelbetween the$responseand$maxBufferLengtharguments. This was done because theServer::listen()method passes only the response and$maxBufferLevelto emitters; previously, this often meant that streams were being chunked 2 bytes at a time versus the expected default of 8kb.If you were calling the
SapiStreamEmitter::emit()method manually previously, you will need to update your code.
Deprecated
- Nothing.
Removed
Fixed
- #248 fixes how the
Uriclass provides user-info within the URI authority; the value is now correctly percent-encoded , per RFC 3986 Section 3.2.1.
-
-
1.4.117 Aug 2017Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- #260 removes support for HHVM, as tests have failed against it for some time.
Fixed
-
#247 fixes the
StreamandRelativeStream__toString()method implementations to check if the streamisSeekable()before attempting torewind()it, ensuring that the method does not raise exceptions (PHP does not allow exceptions in that method). In particular, this fixes an issue when using AWS S3 streams. -
#252 provides a fix to the
SapiEmitterTraitto ensure that anySet-Cookieheaders in the response instance do not override those set by PHP when a session is created and/or regenerated. -
#257 provides a fix for the
PhpInputStream::read()method to ensure string content that evaluates as empty (including0) is still cached. -
#258 updates the
Uri::filterPath()method to allow parens within a URI path, per RFC 3986 section 3.3 (parens are within the character set "sub-delims").
-
1.4.006 Apr 2017Release notes
Open source →Added
-
#219 adds two new classes,
Zend\Diactoros\Request\ArraySerializerandZend\Diactoros\Response\ArraySerializer. Each exposes the static methodstoArray()andfromArray(), allowing de/serialization of messages from and to arrays. -
#236 adds two new constants to the
Responseclass:MIN_STATUS_CODE_VALUEandMAX_STATUS_CODE_VALUE.
Changes
-
#240 changes the behavior of
ServerRequestFactory::fromGlobals()when no$cookiesargument is present. Previously, it would use$_COOKIES; now, if aCookieheader is present, it will parse and use that to populate the instance instead.This change allows utilizing cookies that contain period characters (
.) in their names (PHP's built-in cookie handling renames these to replace.with_, which can lead to synchronization issues with clients). -
#235 changes the behavior of
Uri::__toString()to better follow proscribed behavior in PSR-7. In particular, prior to this release, if a scheme was missing but an authority was present, the class was incorrectly returning a value that did not include a//prefix. As of this release, it now does this correctly.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
-
1.3.1106 Apr 2017Release notes
Open source →Added
- Nothing.
Changes
- #241 changes the
constraint by which the package provides
psr/http-message-implementationto simply1.0instead of~1.0.0, to follow how other implementations provide PSR-7.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
-
1.3.1023 Jan 2017Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #226 fixed an
issue with the
SapiStreamEmittercausing the response body to be cast to(string)and also be read as a readable stream, potentially producing double output.
-
1.3.917 Jan 2017 -
1.3.805 Jan 2017Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #222 fixes the
SapiStreamEmitter's handling of theContent-Rangeheader to properly only emit a range of bytes if the header value is in the formbytes {first-last}/length. This allows using other range units, such asitems, without incorrectly emitting truncated content.
-
1.3.711 Oct 2016Release notes
Open source →Added
- #208 adds several
missing response codes to
Zend\Diactoros\Response, including:- 226 ('IM used')
- 308 ('Permanent Redirect')
- 444 ('Connection Closed Without Response')
- 499 ('Client Closed Request')
- 510 ('Not Extended')
- 599 ('Network Connect Timeout Error')
- #211 adds support
for UTF-8 characters in query strings handled by
Zend\Diactoros\Uri.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
- #208 adds several
missing response codes to
-
1.3.607 Sep 2016Release notes
Open source →Added
- #170 prepared documentation for publication at https://zendframework.github.io/zend-diactoros/
- #165 adds support
for Apache
REDIRECT_HTTP_*header detection in theServerRequestFactory. - #166 adds support for UTF-8 characters in URI paths.
- #204 adds testing against PHP 7.1 release-candidate builds.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #186 fixes a typo
in a variable name within the
SapiStreamEmitter. - #200 updates the
SapiStreamEmitterto implement a check forisSeekable()prior to attempts to rewind; this allows it to work with non-seekable streams such as theCallbackStream. - #169 ensures that
response serialization always provides a
\r\n\r\nsequence following the headers, even when no message body is present, to ensure it conforms with RFC 7230. - #175 updates the
Requestclass to set theHostheader from the URI host if no header is already present. (Ensures conformity with PSR-7 specification.) - #197 updates the
Uriclass to ensure that string serialization does not include a colon after the host name if no port is present in the instance.
-
1.3.517 Mar 2016Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #160 fixes HTTP
protocol detection in the
ServerRequestFactoryto work correctly with HTTP/2.
-
1.3.417 Mar 2016Release notes
Open source →Added
- #119 adds the 451
(Unavailable for Legal Reasons) status code to the
Responseclass.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #117 provides validation of the HTTP protocol version.
- #127 now properly
removes attributes with
nullvalues when callingwithoutAttribute(). - #132 updates the
ServerRequestFactoryto marshal the request path fragment, if present. - #142 updates the
exceptions thrown by
HeaderSecurityto include the header name and/or value. - #148 fixes several stream operations to ensure they raise exceptions when the internal pointer is at an invalid position.
- #151 ensures URI fragments are properly encoded.
- #119 adds the 451
(Unavailable for Legal Reasons) status code to the
-
1.3.304 Jan 2016Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #135 fixes the
behavior of
ServerRequestFactory::marshalHeaders()to no longer omitCookieheaders from the aggregated headers. While the values are parsed and injected into the cookie params, it's useful to have access to the raw headers as well.
-
1.3.222 Dec 2015Release notes
Open source →Added
- #124 adds four
more optional arguments to the
ServerRequestconstructor:array $cookiesarray $queryParamsnull|array|object $parsedBodystring $protocolVersionServerRequestFactorywas updated to pass values for each of these parameters when creating an instance, instead of using the relatedwith*()methods on an instance.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #122 updates the
ServerRequestFactoryto retrieve the HTTP protocol version and inject it in the generatedServerRequest, which previously was not performed.
- #124 adds four
more optional arguments to the
-
1.3.116 Dec 2015Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #113 fixes an issue in the response serializer, ensuring that the status code in the deserialized response is an integer.
- #115 fixes an
issue in the various text-basd response types (
TextResponse,HtmlResponse, andJsonResponse); due to the fact that the constructor was not rewinding the message body stream,getContents()was thus returningnull, as the pointer was at the end of the stream. The constructor now rewinds the stream after populating it in the constructor.
-
1.3.015 Dec 2015Release notes
Open source →Added
- #110 adds
Zend\Diactoros\Response\SapiEmitterTrait, which provides the following private method definitions:injectContentLength()emitStatusLine()emitHeaders()flush()filterHeader()TheSapiEmitterimplementation has been updated to remove those methods and instead compose the trait.
- #111 adds
a new emitter implementation,
SapiStreamEmitter; this emitter type will loop through the stream instead of emitting it in one go, and supports content ranges.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
- #110 adds
-
1.2.115 Dec 2015Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #101 fixes the
withHeader()implementation to ensure that if the header existed previously but using a different casing strategy, the previous version will be removed in the cloned instance. - #103 fixes the
constructor of
Responseto ensure that null status codes are not possible. - #99 fixes
validation of header values submitted via request and response constructors as
follows:
- numeric (integer and float) values are now properly allowed (this solves some reported issues with setting Content-Length headers)
- invalid header names (non-string values or empty strings) now raise an exception.
- invalid individual header values (non-string, non-numeric) now raise an exception.
-
1.2.024 Nov 2015Release notes
Open source →Added
- #88 updates the
SapiEmitterto emit aContent-Lengthheader with the content length as reported by the response body stream, assuming thatStreamInterface::getSize()returns an integer. - #77 adds a new
response type,
Zend\Diactoros\Response\TextResponse, for returning plain text responses. By default, it sets the content type totext/plain; charset=utf-8; per the other response types, the signature isnew TextResponse($text, $status = 200, array $headers = []). - #90 adds a new
Zend\Diactoros\CallbackStream, allowing you to back a stream with a PHP callable (such as a generator) to generate the message content. Its constructor accepts the callable:$stream = new CallbackStream($callable);
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #77 updates the
HtmlResponseto set the charset to utf-8 by default (if no content type header is provided at instantiation).
- #88 updates the
-
1.1.416 Oct 2015Release notes
Open source →Added
- #98 adds
JSON_UNESCAPED_SLASHESto the defaultjson_encodeflags used byZend\Diactoros\Response\JsonResponse.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #98 adds
-
1.1.310 Aug 2015Release notes
Open source →Added
- #73 adds caching of the vendor directory to the Travis-CI configuration, to speed up builds.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #71 fixes the
docblock of the
JsonResponseconstructor to typehint the$dataargument asmixed. - #73 changes the
behavior in
Requestsuch that if it marshals a stream during instantiation, the stream is marked as writeable (specifically, modewb+). - #85 updates the
behavior of
Zend\Diactoros\Uri's variouswith*()methods that are documented as accepting strings to raise exceptions on non-string input. Previously, several simply passed non-string input on verbatim, others normalized the input, and a few correctly raised the exceptions. Behavior is now consistent across each. - #87 fixes
UploadedFileto ensure thatmoveTo()works correctly in non-SAPI environments when the file provided to the constructor is a path.
-
1.1.212 Jul 2015Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #67 ensures that
the
Streamclass only acceptsstreamresources, not any resource.
-
1.1.125 Jun 2015Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #64 fixes the
behavior of
JsonResponsewith regards to serialization ofnulland scalar values; the new behavior is to serialize them verbatim, without any casting.
-
1.1.024 Jun 2015Release notes
Open source →Added
-
#52, #58, #59, and #61 create several custom response types for simplifying response creation:
Zend\Diactoros\Response\HtmlResponseaccepts HTML content via its constructor, and sets theContent-Typetotext/html.Zend\Diactoros\Response\JsonResponseaccepts data to serialize to JSON via its constructor, and sets theContent-Typetoapplication/json.Zend\Diactoros\Response\EmptyResponseallows creating empty, read-only responses, with a default status code of 204.Zend\Diactoros\Response\RedirectResponseallows specifying a URI for theLocationheader in the constructor, with a default status code of 302.
Each also accepts an optional status code, and optional headers (which can also be used to provide an alternate
Content-Typein the case of the HTML and JSON responses).
Deprecated
- Nothing.
Removed
- #43 removed both
ServerRequestFactory::marshalUri()andServerRequestFactory::marshalHostAndPort(), which were deprecated prior to the 1.0 release.
Fixed
-
-
1.0.524 Jun 2015Release notes
Open source →Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #60 fixes
the behavior of
UploadedFilewhen the$errorStatusprovided at instantiation is notUPLOAD_ERR_OK. Prior to the fix, anInvalidArgumentExceptionwould occur at instantiation due to the fact that the upload file was missing or invalid. With the fix, no exception is raised until a call tomoveTo()orgetStream()is made.
-
1.0.423 Jun 2015Release notes
Open source →This is a security release.
A patch has been applied to
Zend\Diactoros\Uri::filterPath()that ensures that paths can only begin with a single leading slash. This prevents the following potential security issues:- XSS vectors. If the URI path is used for links or form targets, this prevents
cases where the first segment of the path resembles a domain name, thus
creating scheme-relative links such as
//example.com/foo. With the patch, the leading double slash is reduced to a single slash, preventing the XSS vector. - Open redirects. If the URI path is used for
LocationorLinkheaders, without a scheme and authority, potential for open redirects exist if clients do not prepend the scheme and authority. Again, preventing a double slash corrects the vector.
If you are using
Zend\Diactoros\Urifor creating links, form targets, or redirect paths, and only using the path segment, we recommend upgrading immediately.Added
- #25 adds documentation. Documentation is written in markdown, and can be converted to HTML using bookdown. New features now MUST include documentation for acceptance.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #51 fixes
MessageTrait::getHeaderLine()to return an empty string instead ofnullif the header is undefined (which is the behavior specified in PSR-7). - #57 fixes the
behavior of how the
ServerRequestFactorymarshals upload files when they are represented as a nested associative array. - #49 provides several
fixes that ensure that Diactoros complies with the PSR-7 specification:
MessageInterface::getHeaderLine()MUST return a string (that string CAN be empty). Previously, Diactoros would returnnull.- If no
Hostheader is set, the$preserveHostflag MUST be ignored when callingwithUri()(previously, Diactoros would not set theHostheader if$preserveHostwastrue, but noHostheader was present). - The request method MUST be a string; it CAN be empty. Previously, Diactoros
would return
null. - The request MUST return a
UriInterfaceinstance fromgetUri(); that instance CAN be empty. Previously, Diactoros would returnnull; now it lazy-instantiates an emptyUriinstance on initialization.
- ZF2015-05 was
addressed by altering
Uri::filterPath()to prevent emitting a path prepended with multiple slashes.
- XSS vectors. If the URI path is used for links or form targets, this prevents
cases where the first segment of the path resembles a domain name, thus
creating scheme-relative links such as
-
1.0.304 Jun 2015Release notes
Open source →Added
- #48 drops the minimum supported PHP version to 5.4, to allow an easier upgrade path for Symfony 2.7 users, and potential Drupal 8 usage.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.
-
1.0.204 Jun 2015Release notes
Open source →Added
- #27 adds phonetic pronunciation of "Diactoros" to the README file.
- #36 adds property
annotations to the class-level docblock of
Zend\Diactoros\RequestTraitto ensure properties inherited from theMessageTraitare inherited by implementations.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #41 fixes the
namespace for test files to begin with
ZendTestinstead ofZend. - #46 ensures that
the cookie and query params for the
ServerRequestimplementation are initialized as arrays. - #47 modifies the
internal logic in
HeaderSecurity::isValid()to use a regular expression instead of character-by-character comparisons, improving performance.
-
1.0.126 May 2015Release notes
Open source →Added
- #10 adds
Zend\Diactoros\RelativeStream, which will return stream contents relative to a given offset (i.e., a subset of the stream).AbstractSerializerwas updated to create aRelativeStreamwhen creating the body of a message, which will prevent duplication of the stream in-memory. - #21 adds a
.gitattributesfile that excludes directories and files not needed for production; this will further minify the package for production use cases.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- #9 ensures that attributes are initialized to an empty array, ensuring that attempts to retrieve single attributes when none are defined will not produce errors.
- #14 updates
Zend\Diactoros\Requestto use aphp://tempstream by default instead ofphp://memory, to ensure requests do not create an out-of-memory condition. - #15 updates
Zend\Diactoros\Streamto ensure that write operations trigger an exception if the stream is not writeable. Additionally, it adds more robust logic for determining if a stream is writeable.
- #10 adds
-
1.0.021 May 2015Release notes
Open source →First stable release, and first release as
zend-diactoros.Added
- Nothing.
Deprecated
- Nothing.
Removed
- Nothing.
Fixed
- Nothing.