All Versions
28
Latest Version
Avg Release Cycle
67 days
Latest Release
1773 days ago

Changelog History
Page 1

  • v3.2.0 Changes

    June 12, 2019

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • #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 of Zend\Stratigility\Next, which encapsulates the middleware pipeline and advances through it on each call to handle().

    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 to handle() within the same scope will therefore result in the exception Zend\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.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • Nothing.
  • v3.1.0 Changes

    February 06, 2019

    โž• Added

    • #178 adds the class Zend\Stratigility\EmptyPipelineHandler, which raises an
      EmptyPipelineException when it handles an incoming request. It's primary
      purpose is for use in the MiddlewarePipe as a fallback handler during
      handle() operations.

    ๐Ÿ”„ Changed

    ๐ŸŽ #178 provides some performance improvements to MiddlewarePipe::handle() by
    having it create an instance of EmptyPipelineHandler to use as a fallback
    ๐Ÿ– handler when it calls process() 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.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • Nothing.
  • v3.0.3 Changes

    February 06, 2019

    โž• Added

    • ๐Ÿ‘ #184 adds support for PHP 7.3.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • Nothing.
  • v3.0.2 Changes

    July 24, 2018

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • ๐Ÿšš #177 removes a conditional from Zend\Stratigility\Middleware\ErrorHandler that can never be reached.

    ๐Ÿ›  Fixed

    • Nothing.
  • v3.0.1 Changes

    April 04, 2018

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  #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.

  • v3.0.0 Changes

    March 15, 2018

    โž• Added

    • #146 adds a new interface, Zend\Stratigility\MiddlewarePipeInterface. It extends the PSR-15 MiddlewareInterface and RequestHandlerInterface, and defines one additional method, pipe(MiddlewareInterface $middleware) : void.

    • #150 adds a new class, Zend\Stratigility\Middleware\RequestHandlerMiddleware. The class implements the PSR-15 RequestHandlerInterface and MiddlewareInterface, and accepts a single constructor argument, a RequestHandlerInterface instance. Each of its handle() and process() methods proxy to the composed request handler's handle() 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.

    ๐Ÿ”„ Changed

    • โšก๏ธ #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 new MiddlewarePipeInterface, and is marked as final, disallowing direct extension. Either decorate an instance in a custom MiddlewarePipeInterface implementation, or create a custom PSR-15 MiddlewareInterface 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 implement Psr\Http\Server\RequestHandlerInterface. Calling it will cause it to pull the first middleware off the queue and create a Next 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 the PathMiddlewareDecorator or path() utility function to pipe middleware with path segregation.

    • #153 modifies the first argument of the Zend\Expressive\Middleware\ErrorHandler and NotFoundHandler classes. Previously, they each expected a Psr\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.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • ๐Ÿšš #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 a MiddlewarePipe and Next instance, and its removal should not affect end users.

    • ๐Ÿšš #134 removes Zend\Stratigility\Exception\InvalidMiddlewareException, as the exception is no longer raised by MiddlewarePipe.

    ๐Ÿ›  Fixed

    • Nothing.
  • v2.2.2 Changes

    April 16, 2018

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  #169 fixes an issue with how the PathMiddlewareDecorator attempts to truncate the path
      ๐Ÿ‘ป when the path is matched case insensitively. Previously, an exception was incorrectly raised;
      now it identifies and truncates correctly.
  • v2.2.1 Changes

    April 04, 2018

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    ๐Ÿ›  #167 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.

  • v2.2.0 Changes

    March 12, 2018

    โž• Added

    • #140 adds the class Zend\Stratigility\Middleware\CallableMiddlewareDecorator for the purpose of decorating callable, standards-signature middleware for use with a MiddlewarePipe instance. Instantiate it directly, passing the callable middleware as the sole argument, or use the Zend\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 a MiddlewarePipe instance. Instantiate it directly, passing the callable middleware and a response instance as arguments, or use the Zend\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 an Interop\Http\Server\MiddlewareInterface instance for the second argument. Alternately, use the Zend\Stratigility\path() utility function to generate the instance: path('/foo', $middleware).

    This decorator class replaces usage of the $path argument to MiddlewarePipe::pipe(), and should be used to ensure your application is forwards-compatible with the upcoming version 3 release.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • ๐Ÿ—„ #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 class Zend\Stratigility\Middleware\CallableMiddlewareDecorator, or the utility function middleware(), 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 class Zend\Stratigility\Middleware\DoublePassMiddlewareDecorator, or the utility function doublePassMiddleware(), 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 the Zend\Stratigility\Middleware\PathMiddlewareDecorator class and/or the Zend\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 using Zend\Stratigility\Middleware\DoublePassMiddleware or Zend\Stratigility\doublePassMiddleware() prior to piping.

    • ๐Ÿ—„ #159 deprecates Zend\Stratigility\MiddlewarePipe::setCallableMiddlewareDecorator(). Use Zend\Stratigility\doublePassMiddleware() or Zend\Stratigility\Middleware\DoublePassMiddleware prior to passing your double-pass middleware to MiddlewarePipe::pipe().

    • ๐Ÿ—„ #159 deprecates Zend\Stratigility\MiddlewarePipe::setResponsePrototype(). This was used only to seed an instance of Zend\Stratigility\Middleware\CallableMiddlewareWrapperFactory previously; pass your response prototype directly to a new instance of Zend\Stratigility\Middleware\DoublePassMiddleware or the `Zend\Stratigility\doublePassMiddleware() function instead.

    • ๐Ÿ—„ #159 deprecates Zend\Stratigility\MiddlewarePipe::hasResponsePrototype().

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • Nothing.
  • v2.2.0.rc3 Changes

    March 08, 2018

    โž• Added

    • Nothing.

    ๐Ÿ”„ Changed

    • Nothing.

    ๐Ÿ—„ Deprecated

    • Nothing.

    โœ‚ Removed

    • Nothing.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fixes the signature of PathRequestHandlerDecorator::process() to typehint against the PSR-7 ServerRequestInterface, and not RequestInterface.