PHP 8.6 Released with Stricter Session Security Defaults
PHP 8.6 tightens session security defaults to mitigate hijacking and CSRF risks, but does not fix the underlying RCE vulnerabilities.
The PHP Foundation released version 8.6 on November 19, 2026, introducing new language features such as Partial Function Application (PFA), a Duration class, a polling API, and a clamp() function. However, the most significant change for developers is the hardening of default security settings in response to recent severe vulnerabilities.
Core developer Jörg Sowa proposed changing the default configuration of the PHP session extension to be more secure. This proposal was unanimously approved and applied starting from PHP 8.6. The changes include enabling strict mode (session.use_strict_mode) by default to prevent session fixation attacks, adding the HttpOnly flag to session cookies to block client-side JavaScript access, and setting the SameSite attribute to Lax to mitigate Cross-Site Request Forgery (CSRF) attacks.
Previously, these settings were either disabled or loosely configured by default, requiring developers to manually enable them. With PHP 8.6, the server will not provide session cookies for cross-site requests except for top-level GET navigations, significantly reducing the risk of session theft and impersonation.
Additionally, PHP 8.6 enforces stricter handling of null values in strings. Instead of silently ignoring null bytes, which can be exploited in remote code execution (RCE) attacks to bypass validation routines, the engine now throws errors when encountering null values in certain contexts.
It is important to note that while these default changes make it harder for attackers to exploit sessions, they do not resolve the specific remote code execution vulnerabilities discovered recently. Seven critical vulnerabilities were identified in October 2026, affecting WordPress, Laravel, and Symfony applications. Patches were released for previous versions, and PHP 8.6 includes all these fixes.
However, the new security defaults only apply if the application, framework, or php.ini file has not explicitly set different values. If an existing server's php.ini or Docker image retains old configurations, the new defaults will not take effect. Backend software engineer Rajeev Kevin Durepul noted that reusing old php.ini files during an upgrade provides no benefit because explicit lines like 'session.use_strict_mode = 0' override the new defaults.