PHP 8.6 was released on Thursday 19 November, on its usual yearly schedule, while the language was still under scrutiny for a series of critical flaws. Since 21 October the PHP Foundation had already had to fix the engine in a hurry, after the PHP2Shell vulnerability allowed an unauthenticated attacker to crash PHP processes or execute code on the server. This release also patches seven critical remote code execution flaws, but the change that matters most to developers concerns the defaults.

Psst!Add AlexTech.ai asPreferred Source on Google

The most significant change involves the session module. Three settings, designed to boost security, had shipped in earlier versions with defaults that left applications exposed for no good reason. Developer Jörg Sowa flagged them in June and proposed safer defaults, a proposal accepted for PHP 8.6.

The first change is Strict Mode. Before, an attacker could plant a made-up session ID on a victim and gain access. Now PHP refuses uninitialised session IDs it did not create itself: if the ID has no matching file on disk, a fresh random ID is generated. The second is the HttpOnly flag on the session cookie, which stops page scripts from reading the ID and using it to impersonate the user. Until now, any script on the page could read it. The third is SameSite set to Lax: the server no longer sends session cookies on cross-site POST requests, nor for subrequests and iframes. Without this, a forged form or link on an attacker-controlled site could trigger authenticated requests using the victim's session.

Taken together, these changes should thwart session hijacking and cross-site request forgery. They do not stop remote code execution, though they make it much harder for attackers to get in. The release adds further measures: the engine is stricter with strings containing null bytes ("\0"), which now throw an error in many cases instead of passing silently. The null byte is a favourite trick for triggering remote execution, because a C function treats it as the end of the string. Several functions, such as those closing a file or copying data, now explicitly return false on failure, so developers can catch data-integrity bugs.

On the feature side, the most anticipated addition is Partial Function Application (PFA), which lets developers pre-fill some arguments and generate a reusable closure on the fly. There is also a native polling API for event-driven networking, a Duration class that tracks elapsed time across more than 250 years, and a clamp() function that keeps a value within a range. For WordPress, the project reports that all known PHP 8.6 compatibility issues were resolved in WordPress 7.2 Beta 5, but advises checking plugins and themes before upgrading. Developers should also watch the deprecated Oniguruma-based mbstring functions.

For administrators, however, the upgrade may not be enough. The new defaults apply only where configuration is not specified elsewhere, in an application, framework or another php.ini file, all of which can override them. Anyone reusing an old php.ini, through an Ansible template or a COPY line in a Dockerfile, moves to 8.6 and gains nothing, because the explicit session.use_strict_mode = 0 line overrides the new default. Laravel and Symfony already manage session cookies with comparable settings, while WordPress does not use PHP sessions for logins, so the main exposure is plugins calling session_start().

Another example from the same week comes from outside software. Security researcher Rasmus Moorats had to jailbreak his car just to update its clock, as reported by Tom's Hardware. His 2014 Renault Latitude would not let him change the time on the display because the SD card holding the navigation maps was missing, something the previous owner had warned him would be needed. When daylight saving time arrived, Moorats had to use reverse engineering to reach the infotainment system, an operation no one should need for such a simple task.

PHP's story also exposes a structural limit. The new settings were welcomed, but the PHP Foundation admitted in October that consensus-driven gridlock had stalled complex fixes for months, and promised faster patches. The project has one full-time staff member, as our newsroom reported in PHP, un solo dipendente a tempo pieno: così la falla è passata. The new protections do not stop the flow of AI-found vulnerabilities, but they make them harder to exploit.