PHP 8.6 adds partial function application, Time\Duration, an event-loop polling API and clamp(), while changing session defaults and deprecating several older behaviors.
Last updated
PHP 8.6 has been released with partial function application, the Time\Duration class, an event-loop polling API and the clamp() function.
Session defaults now enable session.use_strict_mode and session.cookie_httponly, while session.cookie_samesite is set to Lax. Custom session handlers that do not implement both create_sid() and validateId() are deprecated.
fclose(), file_put_contents() and copy() now return false when flushing or closing a file fails. More functions throw ValueError for out-of-range values, invalid flags or strings containing NUL bytes, and stream operations can be configured to throw StreamException with structured error details.
The release also adds the SortDirection enum, defaults for readonly properties, post-quantum key encapsulation in Sodium, TLS 1.3 early data for TLS streams and several deprecations. The mbstring regex functions and older aliases such as is_double() and doubleval() are deprecated; trim(), ltrim() and rtrim() now strip form feeds by default.
Time\Duration measures elapsed time without clock or timezone semantics, while Io\Poll can monitor multiple streams through epoll, kqueue, event ports or WSAPoll. PHP developers recommend PCRE with the u modifier instead of the deprecated mbstring regex functions.