PHP 8.6 brings partial function application and a new Duration class
What's New in PHP 8.6

PHP 8.6, due November 19, 2026, adds partial function application with `?` and `...` placeholders, a `\Time\Duration` class for nanosecond-precision elapsed time, a scalable `Io\Poll` API for event loops like ReactPHP and AMPHP, and a `clamp()` function. It also introduces a `SortDirection` enum, readonly property defaults, structured stream errors, and deprecations including `return` in `finally` and mbstring regex functions.
Using `return` inside a `finally` block is now deprecated, as it silently discards exceptions and overrides values returned from the `try` or `catch` block.
- yabones
Appears the big scary vulnerability that was announced recently is in 8.5+, so definitely upgrade your stuff if you're on a new version... For the rest of us in "debian land" running 8.3-8.4, looks like there's nothing to worry about for now.
https://github.com/php/php-src/security/advisories/GHSA-8mjj...
https://github.com/php/php-src/security/advisories/GHSA-2fjv...
The other Critical CVE looks very very difficult to actually exploit, since it has to do with a very specific configuration during startup.
https://github.com/php/php-src/security/advisories/GHSA-gr4f...
- beberlei
Most excited about the ZTS overhead reduction. If you are unfamiliar PHP can run either with or without thread safety (think using pthreads in PHP requests).
If the overhead can be further reduced (and people have ideas) then it could be that we only need ZTS mode anymore in the future and that can open up one avenue for PHP to get native async support similar to the existing parallel extension: https://github.com/krakjoe/parallel
More "hands-on" is the stream error handling improvements. This greatly improves the old file stream APIs to now allow throwing exceptions instead of returning false on errors:
$context = stream_context_create([
'stream' => [
'error_mode' => StreamErrorMode::Exception,
],
]);
try {
$config = file_get_contents('/etc/app/config.json', context: $context);
} catch (StreamException $e) {
// handle error
}
- p4bl0
I'm a bit sad that there's still no way to limit the number of arguments of a user-defined function in the type system. The internal functions have that.
I know that introducing such a behavior by default could break existing code, but it seems relatively easy to introduce this feature in a backward compatible way by using the void type. For example :
function foo (void) {}
foo(42); // fatal error: foo() expects exactly 0 arguments, 1 given
function bar ($a, $b, void) {}
bar(1, 2, 3); // fatal error: bar() expects exactly 2 arguments, 3 given
function baz ($a, $b=null, void) {}
baz(1, 2, 3); // fatal error: baz() expects at most 2 arguments, 3 given
- nticompass
I /finally/ just upgraded our PHP app from 7.4 to 8.3 (totally not just because of the PHP vulnerabilities). I can't wait to jump to 8.5, so I can use the pipe (`|>`) operator.
I'd love to upgrade to 8.6 so I can use function partials!
- petecooper
Source tagged:
- williamdclt
I can't make up my mind on FPA. On the one hand it's very elegant and I always feel like I need it when writing code, on the other hand it makes a function declaration look reaaaaally close to a function invocation, which is super confusing
- kijin
Before you all get excited about the new version, patch the old version you're running now!
The PHP team announced that they're going to release a critical fix between 14:00 and 14:30 UTC today. Doesn't say whether 8.6 is affected too, but the vulnerability is probably at the top of their mind right now -- even more so than the 8.6 release.
- m4rtink
CVEs!