Sulat.com / Writing on AIFriday, November 20, 2026
Developer Tools/19 November 2026

PHP 8.6 lands 19 November with partial function application, a Duration class and a polling API

PHP 8.6 is due on 19 November UTC with partial function application, a Duration class, a polling API and clamp(). Session defaults get stricter and the mb_ereg() family is deprecated.

Glossy 3D PHP logo on a launch podium between open shipping crates and server racks, with confetti in the air

At a glance

  • PHP's release page says PHP 8.6 is planned for 19 November UTC, and the PHP Foundation marked the day on X with six headline changes.
  • Partial function application lets you write version_compare(?, '8.6', '>=') to get a Closure that waits for the remaining argument, according to php.net's release page.
  • Time\Duration is a new class for elapsed time with nanosecond precision, and the PHP Foundation's Tim Düsterhus says the standard library uses six different representations of time today.
  • The Io\Poll API uses epoll, kqueue, event ports or WSAPoll so event loop libraries such as ReactPHP and AMPHP can watch many streams without stream_select()'s limits.
  • PHP 8.6 turns on session strict mode and HttpOnly cookies by default, and several functions now return false or throw where they used to ignore failures.

PHP 8.6 is due on 19 November UTC, and the PHP Foundation marked the day on X with six headline changes: partial function application, a Time\Duration class, a polling API, a clamp() function, a SortDirection enum and default values for readonly properties. PHP’s release page lists all six and still described 8.6 as not yet released when I read it.

The date runs into Friday morning in New Zealand. PHP’s security releases for the supported branches are scheduled for 14:00 to 14:30 UTC, which is 3:00am to 3:30am NZDT on 20 November, and PHP hasn’t published a time for 8.6.0 itself. My report on those security releases covers what they fix.

Partial application and a Duration class

Partial function application lets you call a function with some arguments filled in and a ? where the rest go. You get a Closure back, which is a function stored in a variable, and the original function only runs once you pass the missing values. In php.net’s example, the callback for array_filter() shrinks to version_compare(?, '8.6', '>='). The RFC is by Larry Garfield and Arnaud Le Blanc.

Three-step flow: call version_compare with a question mark for the first argument, get a Closure back, then pass '8.5' to run it and get false
Fill in what you know now, and the function runs once the gaps are filled.

Time\Duration is a class for elapsed time as a stopwatch measures it. php.net says it’s independent of any time or timezone and covers more than 250 years with nanosecond precision. The PHP Foundation’s blog, by Tim Düsterhus, says the standard library already expresses a length of time as seconds in sleep(), milliseconds in CURLOPT_TIMEOUT_MS, microseconds in usleep(), nanoseconds in hrtime(), a pair of integers in stream_set_timeout() and a float in microtime(true). The new polling API is the first to accept a Duration.

Six boxes for sleep(), usleep(), CURLOPT_TIMEOUT_MS, hrtime(), stream_set_timeout() and microtime(true), each with a different unit, all pointing to one Time Duration box
Six units for the same idea become one type with nanosecond precision.

Düsterhus describes Duration as the first building block of a new date and time API. A Time\Instant and Time\Clock RFC, which adds points in time and a clock interface for testing, is under discussion on PHP’s internals list.

A polling API for event loops

The new Io\Poll API watches many streams at once using whichever mechanism the platform has: epoll, kqueue, event ports or WSAPoll. php.net says it avoids the scalability limits of stream_select(), and its example notes that select() typically can’t handle more than 1,024 connections. PHP positions it as a base for event loop libraries such as ReactPHP and AMPHP. Jakub Zelenka wrote the RFC, and the PHP Foundation’s blog says it came out of the Streams Project.

Side by side: stream_select() typically tops out near 1,024 connections, while Io Poll picks epoll, kqueue, event ports or WSAPoll for event loop libraries
Io\Poll uses what the platform offers, where stream_select() has a connection ceiling.

Three smaller additions

clamp() returns the value if it sits inside a range and the nearest boundary if it doesn’t, so php.net’s clamp(110, 0, 100) returns 100. It works on any comparable value, including a Duration. The SortDirection enum has two cases, Ascending and Descending. Düsterhus says a GitHub search found more than 150 incompatible enums with that name, which is the case he makes for putting one in PHP itself.

Readonly properties can now carry a default value, and the constructor can’t overwrite it. A readonly class can then satisfy a get-only interface property without writing a constructor, as php.net shows:

final readonly class SlugRule implements Rule
{
    public string $parser = SlugParser::class;
}

The release page adds structured stream errors that can throw a StreamException, doc comments on parameters, post-quantum key encapsulation in the Sodium extension (X-Wing and ML-KEM-768), TLS session resumption and faster JSON encoding.

What can break an upgrade

Test the sessions change first. PHP 8.6 turns on session.use_strict_mode and session.cookie_httponly by default and sets session.cookie_samesite to Lax. trim(), ltrim() and rtrim() now strip form feed characters, and fclose(), file_put_contents() and copy() return false when flushing or closing a stream fails. Several functions now throw a ValueError for out-of-range values or strings containing NUL bytes where they used to carry on.

Checklist of five PHP 8.6 upgrade checks: session defaults, trim and form feed, file functions returning false, mb_ereg deprecation, and return inside finally
Five changes in PHP 8.6 that can break working code, according to php.net.

The deprecations include the mb_ereg() and mb_split() family, because the Oniguruma library behind them is no longer maintained; return inside a finally block; the is_double(), is_long(), is_integer() and doubleval() aliases; and spl_object_hash() in favour of spl_object_id(). Using let or is as a class, function or constant name is deprecated too. PHP’s migration guide has the full list, and the changelog will show the 8.6.0 entry once it ships.


Discover more from Sulat AI & Tech News

Subscribe to get the latest posts sent to your email.