Newshot

PHP 8.6 released: simplified code, upgraded concurrency, hardened security

AI summary

The PHP development team released PHP 8.6 on November 19, focusing on simplifying code, improving concurrency handling, enabling secure defaults, and improving the performance of common operations such as JSON encoding. The most notable new feature is "partial function application," which lets developers pre-fill some arguments of a function and supply the rest later to create a reusable new function; other highlights include the new Io\Poll polling interface for monitoring large numbers of network connections and other data streams via native OS mechanisms, the Time\Duration type with nanosecond precision, a clamp() function, readonly properties with default values, and stricter default session settings (strict session mode, HttpOnly session cookies, SameSite=Lax). Performance optimizations cover JSON encoding, formatted output, and some array operations, but the announcement did not give an overall speedup figure.

Translation(model translation, not the source's own text)

PHP 8.6 Released: Simplified Code, Concurrency Upgrade, Security Hardening

IT之家 reported on November 20 that the PHP development team released PHP 8.6 yesterday (November 19), focusing on simplifying code, optimizing concurrent processing and default security settings, and improving the performance of common operations such as JSON encoding.

The most closely watched new feature in PHP 8.6 is "partial function application": developers can fill in some of a function's arguments first and leave the rest to be supplied later, producing a reusable new function. For example, by presetting the rule "replace spaces with hyphens," different text can then be passed in, reducing the need to repeatedly write wrapper code.

Another highlight is the new Io\Poll polling interface, which can monitor large numbers of data streams such as network connections at the same time and call each operating system's native mechanisms, breaking through the scalability limits of the old interface and providing low-level support for asynchronous frameworks handling high-concurrency tasks.

PHP 8.6 also updates its supporting tools: Time\Duration is dedicated to representing elapsed durations, supports nanosecond precision, and makes it easier to manage timeouts and retry intervals; clamp () constrains values within a specified range; and readonly properties now allow default values to be set directly.

On security, the new version enables strict session mode and HttpOnly session cookies by default, and sets the SameSite policy to Lax. Performance optimizations cover JSON encoding, formatted output and some array processing operations, but the announcement did not provide an overall speedup figure.

  • PHP 8.6 changelog

Advertising statement: External redirect links contained in the article (including but not limited to hyperlinks, QR codes, passwords and other forms) are used to convey more information and save selection time; the results are for reference only, and all articles on IT之家 that contain external links include this statement.

The translation is machine-generated and individual terms may be off. Nothing is rewritten or cut; the original is authoritative.

Published by IT之家
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗