The new PHP version is out, and those not switching yet get four security updates for older branches at the same time
Besides partial function application, PHP 8.6 brings its own type for durations and a modern way to watch many connections at once.
The PHP team released PHP 8.6.0 on Thursday, according to the announcement on the PHP Foundation forum. Besides the previously discussed partial function application, in which placeholders let you fill in some arguments in advance, the version brings a \Time\Duration class for elapsed time independent of time zones, with nanosecond precision over more than 250 years. A new Io\Poll interface watches many streams at once via epoll, kqueue or WSAPoll, without the limit of about 1,024 connections of stream_select(), and is meant as a foundation for event loops such as ReactPHP and AMPHP.
There is also a clamp() function that keeps a value within bounds, a SortDirection enum, default values for readonly properties and the option to catch stream errors as exceptions. Sodium gains post-quantum key exchange with X-Wing and ML-KEM-768, and JSON error messages now indicate where in the input things go wrong, according to the official announcement on php.net.
Anyone upgrading must account for changed behaviour: sessions use strict mode, HttpOnly cookies and SameSite=Lax by default, trim() also strips form feeds and a return inside a finally block is deprecated. Security updates 8.5.13, 8.4.28, 8.3.37 and 8.2.36 were released at the same time. According to ShiftDelete, they fix flaws with a critical rating, although the PHP team says they require an unusual configuration. The site advises installing those updates quickly and waiting with 8.6 until hosting providers and frameworks confirm support.