Slim Framework Blog https://www.slimframework.com/blog/ en-us Copyright Josh Lockhart http://blogs.law.harvard.edu/tech/rss [email protected] [email protected] Slim 4.14.0 released https://www.slimframework.com/2024/06/13/slim-4.14.0-release.html <![CDATA[

We are pleased to have released Slim 4.14.0. As a mature release, there aren’t many changes and all are minor and can be seen here.

Type hinting with template generics

This release introduces of template generic docblocks into Slim.

As Slim\App has a getContainer(): ?ContainerInterface method, the generics docblock enables you to specify what type is actually returned when this method is called. i.e. consider that you are using PHP-DI and have this code:

$container = $this->app->getContainer();
$entries = $container->getKnownEntryNames();

Psalm or PHPStan have no way of knowing that $container is an instance of DI\Container which has a getKnownEntryNames() method and so will complain.

To inform the static analyzer that we created Slim\App with PHP-DI, we change: /** @var \Slim\App $app */ to /** @var \Slim\App<DI\Container> $app */ and now PHPStan knows that getKnownEntryNames() is a valid method call on $container.

Update your type hints

For your codebase, if you type hint Slim\App instance variables using /** @var \Slim\App $app */, then you will need to change it to either:

  • /** @var \Slim\App<null> $app */ if you are not using a DI container, or
  • /** @var \Slim\App<\Psr\Container\ContainerInterface> $app */ if you are.

As noted above, you can also type hint to the concrete instance of the container you are using too.

]]>
Thu, 13 Jun 2024 00:00:00 -0400 https://www.slimframework.com/2024/06/13/slim-4.14.0-release.html
Slim 4.13.0 released https://www.slimframework.com/2024/03/03/slim-4.13.0-release.html <![CDATA[

We are excited to announce the Slim 4.13.0 release. The docs are located here.

Changelog

4.13.0 - 2024-03-03

]]>
Sun, 03 Mar 2024 00:00:00 -0500 https://www.slimframework.com/2024/03/03/slim-4.13.0-release.html
Slim 4.12.0 released https://www.slimframework.com/2023/07/22/slim-4.12.0-release.html <![CDATA[

We are excited to announce the Slim 4.12.0 release. The docs are located here.

Changelog

4.12.0 - 2023-07-22

]]>
Sat, 22 Jul 2023 00:00:00 -0400 https://www.slimframework.com/2023/07/22/slim-4.12.0-release.html
Security Advisory: Improper header validation in Slim-Psr7 https://www.slimframework.com/2023/04/17/slim-psr7-advisory-CVE-2023-30536.html <![CDATA[

A security issue has recently been reported in Slim-Psr7 with the handling of new lines in headers.

Impact

An attacker could sneak in a newline (\n) into both the header names and values. While the specification states that \r\n\r\n is used to terminate the header list, many servers in the wild will also accept \n\n. An attacker that is able to control the header names that are passed to Slilm-Psr7 would be able to intentionally craft invalid messages, possibly causing application errors or invalid HTTP requests being sent out with an PSR-18 HTTP client. The latter might present a denial of service vector if a remote service’s web application firewall bans the application due to the receipt of malformed requests.

Affected versions

All versions less than 1.6.1.

Patches

The issue is patched in version 1.6.1.

Workarounds

In Slim-Psr7 1.6.0 and below, validate HTTP header keys and/or values, and if using user-supplied values, filter them to strip off leading or trailing newline characters before calling withHeader().

For example:

$request = $request->withHeader(trim($headerName), trim($headerValue));

Acknowledgments

We are very grateful to and thank Graham Campbell for reporting this issue, providing a patch and working with us on this issue.

Further information

]]>
Mon, 17 Apr 2023 00:00:00 -0400 https://www.slimframework.com/2023/04/17/slim-psr7-advisory-CVE-2023-30536.html
Slim 4.11.0 released https://www.slimframework.com/2022/11/06/slim-4.11.0-release.html <![CDATA[

We are excited to announce the Slim 4.11.0 release. The docs are located here.

Changelog

4.11.0 - 2022-11-06

]]>
Sun, 06 Nov 2022 00:00:00 -0400 https://www.slimframework.com/2022/11/06/slim-4.11.0-release.html
Slim 4.10.0 released https://www.slimframework.com/2022/03/14/slim-4.10.0-release.html <![CDATA[

We are excited to announce the Slim 4.10.0 release. The docs are located here.

Changelog

4.10.0 - 2022-03-14

]]>
Mon, 14 Mar 2022 00:00:00 -0400 https://www.slimframework.com/2022/03/14/slim-4.10.0-release.html
Slim 4.9.0 released https://www.slimframework.com/2021/10/04/slim-4.9.0-release.html <![CDATA[

We are excited to announce the Slim 4.9.0 release. The docs are located here.

Changelog

4.9.0 - 2021-10-04

]]>
Mon, 04 Oct 2021 00:00:00 -0400 https://www.slimframework.com/2021/10/04/slim-4.9.0-release.html
Slim 4.8.0 released https://www.slimframework.com/2021/05/19/slim-4.8.0-release.html <![CDATA[

We are excited to announce the Slim 4.8.0 release. The docs are located here.

Changelog

4.8.0 - 2021-05-19

]]>
Wed, 19 May 2021 00:00:00 -0400 https://www.slimframework.com/2021/05/19/slim-4.8.0-release.html
Slim 4.7.0 released https://www.slimframework.com/2020/11/30/slim-4.7.0-release.html <![CDATA[

We are excited to announce the Slim 4.7.0 release. Please direct all your feedback for this release to the Slim 4 Release Feedback Thread. The new docs are located here.

Changelog

4.7.0 - 2020-11-30

Fixed

Added

Optimizations

]]>
Mon, 30 Nov 2020 00:00:00 -0500 https://www.slimframework.com/2020/11/30/slim-4.7.0-release.html
Slim 4.6.0 released https://www.slimframework.com/2020/11/15/slim-4.6.0-release.html <![CDATA[

We are excited to announce the Slim 4.6.0 release. Please direct all your feedback for this release to the Slim 4 Release Feedback Thread. The new docs are located here.

Changelog

4.6.0 - 2020-11-15

Fixed

Added

Optimizations

Dependencies Updated

]]>
Sun, 15 Nov 2020 00:00:00 -0500 https://www.slimframework.com/2020/11/15/slim-4.6.0-release.html