All notable changes to this project will be documented in this file, in reverse chronological order by release.
Versions prior to 1.0 were originally released as phly/conduit
; please visit
its CHANGELOG for
details.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#186 adds a safeguard to middleware pipes to prevent them from being called multiple times within the same middleware. As an example, consider the following middleware:
public function process( ServerRequestInterface $request, RequestHandlerInterface $handler ) : Response Interface { $session = $request->getAttribute('session'); if (! $session) { $response = $handler->handle($request); } // Inject another attribute before handling $response = $handler->handle($request->withAttribute( 'sessionWasEnabled', true ); return $response; }
When using Stratigility, the
$handler
is an instance ofZend\Stratigility\Next
, which encapsulates the middleware pipeline and advances through it on each call tohandle()
.The example demonstrates a subtle error: the response from the first conditional should have been returned, but wasn't, which has led to invoking the handler a second time. This scenario can have unexpected behaviors, including always returning a "not found" response, or returning a response from a handler that was not supposed to execute (as an earlier middleware already returned early in the original call).
These bugs are hard to locate, as calling
handle()
is a normal part of any middleware, and multiple conditional calls to it are a standard workflow.With this new version,
Next
will pass a clone of itself to the next middleware in the pipeline, and unset its own internal pipeline queue. Any subsequent requests tohandle()
within the same scope will therefore result in the exceptionZend\Stratigility\Exception\MiddlewarePipeNextHandlerAlreadyCalledException
.If you depended on calling
$handler->handle()
multiple times in succession within middleware, we recommend that you compose the specific pipeline(s) and/or handler(s) you wish to call as class dependencies.
- Nothing.
- Nothing.
- Nothing.
- #178 adds the class
Zend\Stratigility\EmptyPipelineHandler
, which raises anEmptyPipelineException
when it handles an incoming request. It's primary purpose is for use in theMiddlewarePipe
as a fallback handler duringhandle()
operations.
-
#178 provides some performance improvements to
MiddlewarePipe::handle()
by having it create an instance ofEmptyPipelineHandler
to use as a fallback handler when it callsprocess()
on itself. This prevents cloning of the pipeline in this scenario, which is used when it acts as an application entrypoint. -
#185 removes the "final" declaration from the
ErrorHandler
class, to allow more easily mocking it for testing.
- Nothing.
- Nothing.
- Nothing.
- #184 adds support for PHP 7.3.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #177 removes a conditional from
Zend\Stratigility\Middleware\ErrorHandler
that can never be reached.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#165 fixes an issue with the
PathMiddlewareDecorator
whereby it was using the original request when invoking the handler it creates, instead of prepending the configured path prefix to the request URI created. With the fix, if middleware alters the request path passed to the handler, the changes will now propagate to later middleware. As an example:new PathMiddlewareDecorator('/api', middleware(function ($request, $handler) { $uri = $request->getUri(); if (! preg_match('#^/v\d+/#', $uri->getPath())) { $request = $request->withUri($uri->withPath('/v1' . $uri->getPath())); } return $handler->handle($request); }));
For the request path
/api/books
, the above will now correctly result in/api/v1/books
being propagated to lower layers of the application, instead of/api/books
.
-
#146 adds a new interface,
Zend\Stratigility\MiddlewarePipeInterface
. It extends the PSR-15MiddlewareInterface
andRequestHandlerInterface
, and defines one additional method,pipe(MiddlewareInterface $middleware) : void
. -
#150 adds a new class,
Zend\Stratigility\Middleware\RequestHandlerMiddleware
. The class implements the PSR-15RequestHandlerInterface
andMiddlewareInterface
, and accepts a single constructor argument, aRequestHandlerInterface
instance. Each of itshandle()
andprocess()
methods proxy to the composed request handler'shandle()
method, returning its result.This class can be useful for adapting request handlers to use within pipelines.
-
#142 adds a new class,
Zend\Stratigility\Middleware\HostMiddlewareDecorator
, which provides host segregation functionality for middleware, allowing conditional execution of middleware only if the requested host matches a configured host.// Only process $middleware if the request host matches 'example.com': $pipeline->pipe(new HostMiddlewareDecorator('example.com', $middleware));
Additionally, the patch provides a utility function,
Zend\Stratigility\host()
, to simplify the above declaration:$pipeline->pipe(host('example.com', $middleware));
-
#128 adds a marker interface,
Zend\Stratigility\Exception\ExceptionInterface
; all package exceptions now implement this interface, allowing you to catch all package-related exceptions by typehinting against it.
-
#145 updates the component to implement and consume ONLY PSR-15 interfaces; http-interop interfaces and callable middleware are no longer directly supported (though Stratigility provides decorators for the latter in order to cast them to PSR-15 implementations).
-
#134 and #146 modify
MiddlewarePipe
in two ways: it now implements the newMiddlewarePipeInterface
, and is marked asfinal
, disallowing direct extension. Either decorate an instance in a customMiddlewarePipeInterface
implementation, or create a custom PSR-15MiddlewareInterface
implementation if piping is not necessary or will allow additional types. -
#155 modifies each of the following classes to mark them
final
:Zend\Stratigility\Middleware\CallableMiddlewareDecorator
Zend\Stratigility\Middleware\DoublePassMiddlewareDecorator
Zend\Stratigility\Middleware\HostMiddlewareDecorator
Zend\Stratigility\Middleware\NotFoundHandler
Zend\Stratigility\Middleware\OriginalMessages
Zend\Stratigility\Middleware\PathMiddlewareDecorator
Zend\Stratigility\Middleware\RequestHandlerMiddleware
Zend\Stratigility\Next
-
#134, #145, and #146 update
MiddlewarePipe
to implementPsr\Http\Server\RequestHandlerInterface
. Calling it will cause it to pull the first middleware off the queue and create aNext
implementation that uses the remaining queue as the request handler; it then processes the middleware. -
#134 removes the ability to specify a path when calling
pipe()
; use thePathMiddlewareDecorator
orpath()
utility function to pipe middleware with path segregation. -
#153 modifies the first argument of the
Zend\Expressive\Middleware\ErrorHandler
andNotFoundHandler
classes. Previously, they each expected aPsr\Http\Message\ResponseInterface
instance; they now both expect a PHP callable capable of producing such an instance. This change was done to simplify re-use of a service for producing unique response instances within dependency injection containers. -
#157 marks the package as conflicting with zendframework/zend-diactoros versions less than 1.7.1. This is due to the fact that that version provides a bugfix for its
Uri::getHost()
implementation that ensures it follows the PSR-7 and IETF RFC 3986 specifications.
- Nothing.
-
#163 removes
Zend\Stratigility\Middleware\PathRequestHandlerDecorator
, as it was deprecated in 2.2, and no longer used with the 3.0 code base. -
#122 removes support for PHP versions 5.6, 7.0, as well as HHVM.
-
#122 removes the following classes:
Zend\Stratigility\Delegate\CallableDelegateDecorator
Zend\Stratigility\Exception\InvalidRequestTypeException
Zend\Stratigility\Exception\MissingResponsePrototypeException
Zend\Stratigility\MiddlewareInterface
Zend\Stratigility\Middleware\CallableInteropMiddlewareWrapper
Zend\Stratigility\Middleware\CallableMiddlewareWrapper
Zend\Stratigility\Middleware\CallableMiddlewareWrapperFactory
Zend\Stratigility\NoopFinalHandler
-
#134 removes the class
Zend\Stratigility\Route
. This was an internal message passed between aMiddlewarePipe
andNext
instance, and its removal should not affect end users. -
#134 removes
Zend\Stratigility\Exception\InvalidMiddlewareException
, as the exception is no longer raised byMiddlewarePipe
.
- Nothing.
-
#140 adds the class
Zend\Stratigility\Middleware\CallableMiddlewareDecorator
for the purpose of decorating callable, standards-signature middleware for use with aMiddlewarePipe
instance. Instantiate it directly, passing the callable middleware as the sole argument, or use theZend\Stratigility\middleware()
utility function to generate the instance:middleware($callable)
. -
#140 adds the class
Zend\Stratigility\Middleware\DoublePassMiddlewareDecorator
for the purpose of decorating callable, double-pass middleware for use with aMiddlewarePipe
instance. Instantiate it directly, passing the callable middleware and a response instance as arguments, or use theZend\Stratigility\doublePassMiddleware()
utility function to generate the instance:doublePassMiddleware($callable, $response)
. -
#140 adds the class
Zend\Stratigility\Middleware\PathMiddlewareDecorator
for the purposes of creating path-segregated middleware. The constructor expects a string path literal as the first argument, and anInterop\Http\Server\MiddlewareInterface
instance for the second argument. Alternately, use theZend\Stratigility\path()
utility function to generate the instance:path('/foo', $middleware)
.This decorator class replaces usage of the
$path
argument toMiddlewarePipe::pipe()
, and should be used to ensure your application is forwards-compatible with the upcoming version 3 release.
- Nothing.
-
#140 deprecates the class
Zend\Stratigility\Route
. This class is an internal detail, and will be removed in version 3.0.0. -
#140 deprecates the class
Zend\Stratigility\Exception\InvalidMiddlewareException
. This class will be removed in version 3.0.0 as it will no longer be necessary due to typehint usage. -
#140 deprecates the class
Zend\Stratigility\Exception\InvalidRequestTypeException
as it is no longer used by the package. It will be removed in version 3.0.0. -
#140 deprecates the class
Zend\Stratigility\Middleware\CallableInteropMiddlewareWrapper
as it is based on interfaces that will no longer be used starting in version 3.0.0. It will be removed in version 3.0.0. Please use the new classZend\Stratigility\Middleware\CallableMiddlewareDecorator
, or the utility functionmiddleware()
, to decorate callable standards-signature middleware. -
#140 deprecates the class
Zend\Stratigility\Middleware\CallableMiddlewareWrapper
as it is based on interfaces that will no longer be used starting in version 3.0.0. It will be removed in version 3.0.0. Please use the new classZend\Stratigility\Middleware\DoublePassMiddlewareDecorator
, or the utility functiondoublePassMiddleware()
, to decorate callable double pass middleware. -
#140 deprecates the class
Zend\Stratigility\Middleware\CallableMiddlewareWrapperFactory
as the class it is associated will be removed starting in version 3.0.0. The class will be removed in version 3.0.0. -
#140 deprecates the class
Zend\Stratigility\NoopFinalHandler
as the class will be removed starting in version 3.0.0. -
#140 deprecates the two-argument form of
Zend\Stratigility\MiddlewarePipe::pipe()
. If you need to perform path segregation, use theZend\Stratigility\Middleware\PathMiddlewareDecorator
class and/or theZend\Stratigility\path()
function to decorate your middleware in order to provide path segregation. -
#140 deprecates the piping of double pass middleware directly to
pipe()
; decorate your double-pass middleware usingZend\Stratigility\Middleware\DoublePassMiddleware
orZend\Stratigility\doublePassMiddleware()
prior to piping. -
#159 deprecates
Zend\Stratigility\MiddlewarePipe::setCallableMiddlewareDecorator()
. UseZend\Stratigility\doublePassMiddleware()
orZend\Stratigility\Middleware\DoublePassMiddleware
prior to passing your double-pass middleware toMiddlewarePipe::pipe()
. -
#159 deprecates
Zend\Stratigility\MiddlewarePipe::setResponsePrototype()
. This was used only to seed an instance ofZend\Stratigility\Middleware\CallableMiddlewareWrapperFactory
previously; pass your response prototype directly to a new instance ofZend\Stratigility\Middleware\DoublePassMiddleware
or the ``Zend\Stratigility\doublePassMiddleware()` function instead. -
#159 deprecates
Zend\Stratigility\MiddlewarePipe::hasResponsePrototype()
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #119 updates to
webimpress/http-middleware-compatibility
^0.1.3
. This was done to ensure backwards compatibilty by injecting the projectcomposer.json
with the currently installed version of http-interop/http-middleware, and in cases where that package is not yet installed, prompting the user to install it. This approach provides a tiered migration path to http-middleware 0.5.0 for users.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #118 fixes how
the
MiddlewarePipe
detects if the second parameter of callable middleware is a delegate/request handler when choosing whether or not to decorate it to ensure that it will properly decorate it when used with http-interop/http-middleware 0.5.0
-
#112 adds support for http-interop/http-middleware 0.5.0 via a polyfill provided by the package webimpress/http-middleware-compatibility. Essentially, this means you can drop this package into an application targeting either the 0.4.1 or 0.5.0 versions of http-middleware, and it will "just work".
-
Adds support for PHP 7.2.
- Nothing.
- Nothing.
-
Removes support for HHVM.
-
#107 removes the unused
$raiseThrowables
property fromZend\Stratigility\Next
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #98 fixes how
Middleware::pipe()
handlesMiddlewarePipe
instances passed to it; previously it was incorrectly wrapping them inCallableMiddlewareWrapper
instances; it now pipes them as-is.
- Nothing.
-
#96 changes the minimum supported http-interop/http-middleware version to 0.4.1. This impacts several things:
-
Middleware that implemented the http-interop/http-middleware 0.2.0 interfaces will no longer work with Stratigility. In most cases, these can be updated by changing import statements. As an example:
// http-middleware 0.2.0: use Interop\Http\Middleware\DelegateInterface; use Interop\Http\Middleware\ServerMiddlewareInterface; // Becomes the following under 0.4.1: use Interop\Http\ServerMiddleware\DelegateInterface; use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
-
The various classes under
Zend\Stratigility\Middleware
now implement the new interfaces, which could affect extending classes. -
Zend\Stratigility\Next
andZend\Stratigility\Delegate\CallableDelegateDecorator
have signature changes due to changes in theDelegateInterface
; again, these changes should only affect those extending the classes. -
Interop\Http\Middleware\MiddlewareInterface
(which was intended for implementation by client-side middleware) no longer exists, which means it is also no longer supported within Stratigility.
-
-
#67 updates each of
Zend\Stratigility\MiddlewarePipe
,Zend\Stratigility\Middleware\ErrorHandler
, andZend\Stratigility\Middleware\NotFoundHandler
to require all arguments (none are optional). -
#67 modifies the internals of
Zend\Stratigility\MiddlewarePipe
's__invoke()
method.- When instantiating the
Next
instance, it now captures it in a variable named$layer
. - If the result of
Next
is not a response instance, the response passed during invocation is promoted as the layer response. - The response is then passed to the
$next
argument provided at invocation, and the result of that returned without verification.
In most cases, this should have no impact on your application.
- When instantiating the
-
#71 modifies
Zend\Stratigility\MiddlewarePipe
such that it no longer decorates the request and response provided at invocation with theZend\Stratigility\Http\*
variants, as these have been removed. -
#76 updates
MiddlewarePipe
to implement only the http-interop/http-middleware server-side middleware interface, and not the Stratigility-specificMiddlewareInterface
(which was removed). -
#76 updates
Zend\Stratigility\Middleware\ErrorHandler
to implement the http-interop/http-middleware server-side middleware interface instead of the Stratigility-specificMiddlewareInterface
(which was removed). -
#76 updates
Zend\Stratigility\Middleware\NotFoundHandler
to implement the http-interop/http-middleware server-side middleware interface instead of the Stratigility-specificMiddlewareInterface
(which was removed). -
#76 updates
MiddlewarePipe::__invoke()
to require a third argument, now named$delegate
, and no longer type-hinted. If a callable not implementing http-interop/http-middlewareDelegateInterface
is provided, it is wrapped in theCallableDelegateDecorator
(introduced in 1.3.0). The method then calls its ownprocess()
method with the request and delegate. This method should typically only be used as an entry point for an application. -
#76 updates
MiddlewarePipe::pipe()
to raise an exception if callable middleware using the legacy double-pass signature is provided, but no response prototype is composed in theMiddlewarePipe
instance yet. -
#76 updates the constructor of
Next
to rename the$done
argument to$nextDelegate
and typehint it against the http-interop/http-middlewareDelegateInterface
. -
#76 updates
Next::__invoke()
to remove all arguments except the$request
argument; the method now proxies to the instanceprocess()
method. -
#76 updates
Next
to no longer compose aDispatch
instance; it is now capable of dispatching on its own. -
#76 updates the
Zend\Stratigility\Route
constructor to raise an exception if non-http-interop middleware is provided as the route handler. -
#79 updates the
raiseThrowables()
method of each ofMiddlewarePipe
andNext
to be no-ops.
- #79 deprecates
the
raiseThrowables()
method of each ofMiddlewarePipe
andNext
.
-
Zend\Stratigility\Exception\MiddlewareException
was removed as it is no longer thrown. -
#67 removes
Zend\Stratigility\FinalHandler
. UseZend\Stratigility\NoopFinalHandler
instead, along withZend\Stratigility\Middleware\ErrorHandler
andZend\Stratigility\Middleware\NotFoundHandler
(or equivalents). -
#67 removes
Zend\Stratigility\ErrorMiddlewareInterface
. Register middleware, such asZend\Stratigility\Middleware\ErrorHandler
, in outer layers of your application to handle errors. -
#67 removes
Zend\Stratigility\Dispatch
. This was an internal detail of theNext
implementation, and should not affect most applications. -
#67 removes
Zend\Stratigility\Utils::getArity()
. This was used only inDispatch
; since middleware signatures no longer vary, it is no longer necessary. -
#67 removes the final, optional
$err
argument toZend\Stratigility\Next()
; raise exceptions instead, and provide error handling middleware such asZend\Stratigility\Middleware\ErrorHandler
instead. -
#67 removes the
$done
argument to theZend\Stratigility\Next
constructor. -
#71 removes the
Zend\Stratigility\Http\Request
class. -
#71 removes the
Zend\Stratigility\Http\Response
class. -
#71 removes
Zend\Stratigility\Http\ResponseInterface
. -
#76 removes
Zend\Stratigility\MiddlewareInterface
andZend\Stratigility\ErrorMiddlewareInterface
. The latter is removed entirely, while the former is essentially replaced by http-interop'sServerMiddlewareInterface
. You may still write callable middleware using the legacy double-pass signature, however. -
#76 removes the
Zend\Stratigility\Dispatch
class. The class was an internal detail ofNext
, and no longer required.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #86 fixes the links to documentation in several exception messages to ensure they will be useful to developers.
- Nothing.
- Nothing.
- Nothing.
- #95 fixes an
issue with how the
$err
is dealt with. Specifically, if an error arises, then subsequent middlewares should be dispatched as callables. Without this fix, stratigility would simply continue dispatching middlewares, ignoring the failing ones.
- Nothing.
- Nothing.
- Nothing.
- #85 fixes an
issue with how the
$done
or$nextDelegate
is invoked byNext
when an error is present. Previously, the class was detecting aNext
instance as an http-interopDelegateInterface
instance and dropping the error; this would then mean if the instance contained error middleware, it would never be dispatched.
-
#66 adds a new class,
Zend\Stratigility\Middleware\NotFoundHandler
. This class may be piped into an application at an innermost layer; when invoked, it will return a 404 plain text response. -
#66 adds a new class,
Zend\Stratigility\Middleware\ErrorHandler
. This class may be piped into an application, typically at the outermost or one of the outermost layers. When invoked, it does the following:- Creates a PHP error handler that will re-throw PHP errors as
ErrorExceptions
. - Dispatches to the next layer.
- If the next layer does not return a response, it raises a new
MissingResponseException
. - Catches all exceptions from calling the next layer, and passes them to an error response generator to return an error response.
A default error response generator is provided, which will return a 5XX series response in plain text. You may provide a callable generator to the constructor in order to customize the response generated; please refer to the documentation for details.
- Creates a PHP error handler that will re-throw PHP errors as
-
#66 adds a new class,
Zend\Stratigility\NoopFinalHandler
. This class may be provided as the$out
argument to aMiddlewarePipe
, or as the final handler toZend\Diactoros\Server::listen()
(in which case it will be passed to the middleware you invoke as the application). This handler returns the response provided to it verbatim. -
#70 adds a new class,
Zend\Stratigility\Middleware\OriginalMessages
. Compose this middleware in an outermost layer, and it will inject the following attributes in the request passed to nested layers:originalRequest
, representing the request provided to it.originalResponse
, representing the response provided to it.originalUri
, representing URI instance composed in the request provided to it.
-
#75 adds support for http-interop middleware 0.2.0. For full details, see the migration guide. As a summary of features:
- You may now pipe http-interop middleware to
MiddlewarePipe
instances. - You may now pipe callable middleware that defines the same signature as
http-interop middleware to
MiddlewarePipe
instances; these will be decorated in aZend\Stratigility\Middleware\CallableInteropMiddlewareWrapper
instance. MiddlewarePipe
now implements the http-interopServerMiddlewareInterface
, allowing it to be used in http-interop middleware dispatchers.
- You may now pipe http-interop middleware to
-
#75 adds the class
Zend\Stratigility\Middleware\CallableMiddlewareWrapper
. It accepts callable double-pass middleware and a response prototype, and implements the http-interopServerMiddlewareInterface
, allowing you to adapt existing callable middleware to work with http-interop middleware dispatchers. -
#75 adds the class
Zend\Stratigility\Middleware\CallableInteropMiddlewareWrapper
. It accepts callable middleware that follows the http-interopServerMiddlewareInterface
, and implements that interface itself, to allow composing such middleware in http-interop middleware dispatchers. -
#75 adds the class
Zend\Stratigility\Delegate\CallableDelegateDecorator
, which can be used to add http-interop middleware support to your existing callable middleware. -
#75 adds a new method to
MiddlewarePipe
,setResponseProtoype()
. When this method is invoked with a PSR-7 response, the following occurs:- That response is injected in
Next
andDispatch
instances, to allow dispatching legacy callable middleware as if it were http-interop middleware. - Any callable middleware implementing the legacy signature will now be
decorated using the above
CallableMiddlewareWrapper
in order to adapt it as http-interop middleware.
- That response is injected in
-
#78 adds a new method to each of
Zend\Stratigility\MiddlewarePipe
,Next
, andDispatch
:raiseThrowables()
. When called,Dispatch
will no longer wrap dispatch of middleware in a try/catch block, allowing throwables/exceptions to bubble out. This enables the ability to create error handling middleware as an outer layer or your application instead of relying on error middleware and/or the final handler. Typical usage will be to call the method on theMiddlewarePipe
before dispatching it.
-
#70 makes the following changes to
Zend\Stratigility\FinalHandler
:- It now pulls the original request using the
originalRequest
attribute, instead ofgetOriginalRequest()
; see the deprecation ofZend\Stratigility\Http\Request
, below, for why this works. - It no longer writes to the response using the
Zend\Stratigility\Http\Response
-specificwrite()
method, but rather pulls the message body and writes to that.
- It now pulls the original request using the
-
#75 updates
MiddlewarePipe
to inject the$response
argument to__invoke()
as the response prototype. -
#75 updates
Zend\Stratigility\Next
to implement the http-interop middlewareDelegateInterface
. It also updatesZend\Stratigility\Dispatch
to add a new method,process()
, following theDelegateInterface
signature, thus allowingNext
to properly process http-interop middleware. These methods will use the composed response prototype, if present, to invoke callable middleware using the legacy signature. -
#75 updates
Next
to allow the$done
constructor argument to be an http-interopDelegateInterface
, and will invoke it as such if the queue is exhausted. -
#75 updates
Route
(which is used internally byMiddlewarePipe
to allow either callable or http-interop middleware as route handlers.
-
#66 deprecates the
Zend\Stratigility\FinalHandler
class. We now recommend using theNoopFinalHandler
, along with theErrorHandler
andNotFoundHandler
middleware (or equivalents) to provide a more fine-grained, flexible, error handling solution for your applications. -
#66 deprecates the
Zend\Stratigility\Dispatch
class. This class is used internally byNext
, and deprecation should not affect the majority of users. -
#66 deprecates
Zend\Stratigility\ErrorMiddlewareInterface
. We recommend instead using exceptions, along with theErrorHandler
, to provide error handling for your application. -
#66 updates
Zend\Stratigility\MiddlewarePipe::__invoke()
to emit a deprecation notice if no$out
argument is provided, as version 2 will require it. -
#66 updates
Zend\Stratigility\Next::__invoke()
to emit a deprecation notice if a non-null$err
argument is provided; middleware should raise an exception, instead of invoking middleware implementingErrorMiddlewareInterface
. -
#70 deprecates
Zend\Stratigility\Http\Request
. Additionally:- The composed "PSR Request" is now injected with an additional attribute,
originalRequest
, allowing retrieval using standard PSR-7 attribute access. - The methods
getCurrentRequest()
andgetOriginalRequest()
now emit deprecation notices when invoked, urging users to update their code.
- The composed "PSR Request" is now injected with an additional attribute,
-
#70 deprecates
Zend\Stratigility\Http\ResponseInterface
. -
#70 deprecates
Zend\Stratigility\Http\Response
. Additionally, the methodswrite()
,end()
,isComplete()
, andgetOriginalResponse()
now emit deprecation notices when invoked, urging users to update their code. -
#75 deprecates the
$response
argument in existing callable middleware. Please only operate on the response returned by$next
/$delegate
, or create a response. See the documentation section on response arguments for more details. -
#75 deprecates usage of error middleware, and thus deprecates the
$err
argument to$next
; explicitly invoking error middleware using that argument to$next
will now raise a deprecation notice.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #52 fixes the
behavior of the
FinalHandler
with regards to exception handling, ensuring that the reason phrase reported corresponds to the HTTP status code used. - #54 modifies the
behavior of the
FinalHandler
when creating an error or 404 response to callwrite()
instead ofend()
on the response object. This fixes a lingering issue with emitting theContent-Length
header from theSapiEmitter
, as well as prevents theSapiEmitter
from raising exceptions when doing so (which was happening starting with 1.2.0).
This release contains two potential backwards compatibility breaks:
-
In versions prior to 1.2.0, after
Zend\Stratigility\Http\Response::end()
was called,with*()
operations were performed as no-ops, which led to hard-to-detect errors. Starting with 1.2.0, they now raise aRuntimeException
. -
In versions prior to 1.2.0,
Zend\Stratigility\FinalHandler
always provided exception details in the response payload for errors. Starting with 1.2.0, it only does so if not in a production environment (which is the default environment).
- #36 adds a new
InvalidMiddlewareException
, with the static factoryfromValue()
that provides an exception message detailing the invalid type.MiddlewarePipe
now throws this exception from thepipe()
method when a non-callable value is provided. - #46 adds
FinalHandler::setOriginalResponse()
, allowing you to alter the response used for comparisons when theFinalHandler
is invoked. - #37 and
#49 add
support in
Zend\Stratigility\Dispatch
to catch PHP 7Throwable
s.
- Nothing.
- Nothing.
- #30 updates the
Response
implementation to raise exceptions fromwith*()
methods if they are called afterend()
. - #46 fixes the
behavior of
FinalHandler::handleError()
to only display exception details when not in production environments, and changes the default environment to production.
- Nothing.
- Nothing.
- Nothing.
- #39 updates the FinalHandler to ensure that emitted exception messages include previous exceptions.
- Nothing.
- Nothing.
- Nothing.
- #32 updates the
request and response typehints in
Zend\Stratigility\Dispatch
to use the corresponding PSR-7 interfaces, instead of the Stratigility-specific decorators. This fixes issues when calling$next()
with non-Stratigility instances of either.
- Nothing.
- Nothing.
- Nothing.
- #25 modifies the
constructor of
Next
to clone the incomingSplQueue
instance, ensuring the original can be re-used for subsequent invocations (e.g., within an async listener environment such as React).
- #13 adds
Utils::getStatusCode($error, ResponseInterface $response)
; this static method will attempt to use an exception code as an HTTP status code, if it falls in a valid HTTP error status range. If the error is not an exception, it ensures that the status code is an error status.
- Nothing.
- Nothing.
- #12 updates
FinalHandler
such that it will return the response provided at invocation if it differs from the response at initialization (i.e., a new response instance, or if the body size has changed). This allows you to safely call$next()
from all middleware in order to allow post-processing.
- Nothing.
- Nothing.
- Nothing.
- #8 adds a
phpcs.xml
PHPCS configuration file, allowing execution of each ofphpcs
andphpcbf
without arguments.
- Nothing.
- Nothing.
- #7 ensures that
arity checks on PHP callables in array format (
[$instance, $method]
,['ClassName', 'method']
) work, as well as on static methods using the string syntax ('ClassName::method'
). This allows them to be used without issue as middleware handlers.
First stable release, and first relase as zend-stratigility
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.