« All posts

PHP 8.6 Preview: Partial Application, Polling API, and Clamp()

PHP 8.6 preview: partial function application, a new Polling API, built-in clamp(), reflection updates, and stricter session security defaults.

PHP 8.6, due November 19, 2026, brings a mix of syntax sugar and low-level infrastructure changes. Partial function application (PFA) lets developers pre-fill closure parameters, pairing especially well with the pipe operator for cleaner functional-style chains. Because property hooks can now be defined on interfaces, readonly properties can finally carry default values, which previously conflicted with PHP's constant-like treatment of readonly fields.

A new Polling API unifies I/O multiplexing for internals like PHP-FPM and ZTS signal handling, while also being exposed to userland. It supports backends such as epoll and WSAPoll, offering better performance than stream_select() at scale, and could be adopted by libraries like ReactPHP or Amp — though PHP still ships no built-in event loop.

Other additions include a built-in clamp() function that works across numerics, strings, and DateTime objects; isReadable()/isWriteable() methods on ReflectionProperty for inspecting property hook access; getDocComment() support on ReflectionParameter for static analyzers; and a new SortDirection enum for standardizing sort order across frameworks. Session security also improves by default, with stricter session ID validation, HTTP-only cookies, and SameSite=Lax now enabled out of the box.

For engineers, these changes tighten PHP's type and security posture while expanding its functional programming toolkit — teams using custom session handlers or externally issued session IDs should review the strict-mode changes before upgrading.