PHP development team releases PHP 8.6 with safer session defaults

Strict mode and HttpOnly switch from off to on, while SameSite changes from unset to Lax. Existing settings can override the changes, so administrators need to check their configurations after upgrading.
In this article
The PHP development team released PHP 8.6.0, the first release of the programming language’s 8.6 branch, on 19 November 2026. Its new defaults are intended to make sessions—the way applications keep track of users between requests—safer without requiring changes to application code in the common case.
Previously, PHP left strict session-ID checks and the HttpOnly cookie flag off by default and did not set a SameSite cookie policy. The release changes all three, although an application’s existing configuration can still take precedence.
What the session changes do
| Setting | Old default | New default |
|---|---|---|
session.use_strict_mode | 0 | 1 |
session.cookie_httponly | 0 | 1 |
session.cookie_samesite | Not set | Lax |
Strict mode rejects unrecognized session IDs supplied by a client. That helps prevent session fixation, in which an attacker plants a known ID before a victim signs in. HttpOnly tells browsers not to let JavaScript read the session cookie, including when an attacker has injected a script into a page.
SameSite=Lax restricts when browsers send the cookie across sites, helping protect against forged authenticated requests. Browsers still send it for same-site requests and top-level cross-site navigation using safe methods such as GET, but not for cross-site POST requests or subresource requests.
PHP contributor Jörg Sowa proposed the changes on 4 April 2026, saying the old defaults left applications unnecessarily exposed. He opened separate votes on 3 May; they were scheduled to close 18 May, and all three changes were accepted without votes against them.
Check the settings after upgrading
Backend engineer Rajekevin Dourepoulle warned that an explicit setting in an old php.ini file, another configuration file, an application or a framework can override the new defaults. For example, carrying over session.use_strict_mode = 0 leaves strict mode off, The Register said.
Administrators can use ini_get() within an application to check the value of each setting. A boolean off value is returned as an empty string or "0", and on as "1". PHP can also load additional configuration files after php.ini; php_ini_scanned_files() or the --ini option lists scanned files and their order.
Developers should test custom session handlers and any flow that reads a session cookie in JavaScript or relies on a cookie in a cross-site POST. PHP now deprecates custom handlers that do not implement both create_sid() and validateId(); handlers that accept every ID do not gain strict-mode validation. For cross-site POST flows, Sowa’s proposal describes an explicit SameSite=None; Secure setting for the relevant endpoints or a move to a token-based flow.
The session defaults do not stop remote code execution, in which an attacker can run code on a server. The Register said the new release and separate patched versions—8.5.13, 8.4.28, 8.3.37 and 8.2.36—closed seven critical remote code execution flaws.
New tools and error handling
Partial function application lets developers fill in some inputs to a function in advance and create a reusable function that accepts the rest. The new Io\Poll API monitors multiple streams using mechanisms available on each platform and is designed as a foundation for libraries that handle events.
The Time\Duration class represents elapsed time, while clamp() keeps a value within a specified range by returning the nearest boundary when necessary. The release also lets readonly properties have default values and adds SortDirection, a shared way to express sort order.
Many functions now raise a ValueError for strings containing NUL bytes or other invalid input instead of silently truncating or ignoring them. The fclose(), file_put_contents() and copy() functions also return false when flushing or closing a stream fails.
For teams planning upgrades, PHP’s published schedule puts the end of security support for PHP 8.2 on 31 December 2026. For PHP 8.3, 8.4 and 8.5, security support ends on 31 December 2027, 2028 and 2029 respectively. PHP 8.6 is scheduled to receive active support through 31 December 2028, followed by critical security support through 31 December 2030.
Follow AveNews
Earlier in Technology
Physics, Maths & DiscoveriesSutherland and others compile Alpöge’s proposed Riemann proof
Further checks matched five theorem statements and found only standard starting assumptions, but mathematical review of the argument continues.
3 min
SoftwareHackers breach US farmer-payment system, former officials say
The Agriculture Department notified employees, while two former officials warned that the compromised system could provide a route to other sensitive information.
2 min
SoftwareSOCRadar finds bookings but no card numbers in Visa, Mastercard files
The security firm says the published samples also contain mobile numbers, but represent only a small fraction of the data an extortion group claims to have stolen.
3 min
Sources
Show all 8 sourcesShow fewer
- news-web.php.netphp.announce: [ANNOUNCE] PHP 8.6.0 Released (opens in a new tab)
- php.netPHP: PHP 8.6 Release Announcement (opens in a new tab)
- php.netPHP: Supported Versions (opens in a new tab)
- wiki.php.netPHP: rfc:session_security_defaults (opens in a new tab)
The RegisterPHP 8.6: Things are gonna get a lot more strict around here (opens in a new tab)
- discourse.thephp.foundation[PHP-DEV] [VOTE] Secure Session Configuration Defaults - php.internals - PHP Foundation Discourse (opens in a new tab)
- php.netPHP: ini_get - Manual (opens in a new tab)
- php.netPHP: The configuration file - Manual (opens in a new tab)
