# PHP 8.6 Released: What's New, Breaking Changes and How to Upgrade

> PHP 8.6.0 shipped on 19 Nov 2026. See the new features, the session defaults that can break logins, the deprecations to fix, and a safe upgrade plan.

Source: https://www.epifive.com/blog/php-8-6-released-whats-new-upgrade · Published 2026-11-20 · EpiFive

## Key takeaways

- php.net lists PHP 8.6.0 as released on 19 Nov 2026, with security support until 31 Dec 2030.
- Three session defaults changed (strict mode, httponly, SameSite Lax) and are the most likely cause of login problems after upgrading.
- trim(), ltrim() and rtrim() now also strip the form feed character by default.
- PHP 8.2 reaches the end of security support on 31 Dec 2026, so 8.2 users have a deadline.
- Test on staging with E_ALL and deprecations visible before any production upgrade.

PHP 8.6.0 was released on 19 November 2026. It adds partial function application, a `clamp()` function, a polling API and a `Duration` class, and it changes three session defaults that can break logins in older applications. Test on a staging copy first, fix the deprecations and session settings, then upgrade production with the previous PHP version still installed for rollback.

## Who this is for

This guide is for developers, sysadmins and site owners who run PHP applications (custom code, Laravel, Symfony, WordPress or similar) and need to decide when to move to PHP 8.6. By the end you will know which release details matter, which changes are likely to affect an existing application, and what a safe test-then-upgrade sequence looks like. It does not cover every function change; the official lists are linked at the end.

## Release facts and support dates

The php.net release announcement page is titled "PHP 8.6.0 Released!" and gives the date as November 19, 2026. The supported versions page lists the following, as checked on 2026-11-20:

| Branch | Initial release | Active support until | Security support until |
|---|---|---|---|
| 8.2 | 8 Dec 2022 | 31 Dec 2024 | 31 Dec 2026 |
| 8.3 | 23 Nov 2023 | 31 Dec 2025 | 31 Dec 2027 |
| 8.4 | 21 Nov 2024 | 31 Dec 2026 | 31 Dec 2028 |
| 8.5 | 20 Nov 2025 | 31 Dec 2027 | 31 Dec 2029 |
| 8.6 | 19 Nov 2026 | 31 Dec 2028 | 31 Dec 2030 |

Each branch gets two years of active support followed by two years of security-only fixes. Two practical consequences follow. Anyone on 8.2 has until 31 Dec 2026 before security fixes stop, and 8.4 leaves active support on the same date. If you are on 8.2, the upgrade is no longer optional housekeeping. For the current security releases on supported branches, see [/blog/php-security-release-november-2026-update](https://www.epifive.com/blog/php-security-release-november-2026-update).

A new minor version is not automatically the right target for production on day one. Hosting panels, distribution repositories and Docker images may not offer 8.6 yet, and extensions you depend on may need a release of their own. Start testing now, and treat the first weeks as a preparation window.

## What is new in PHP 8.6

The release page groups the headline features as follows.

### Partial function application

You can pass `?` placeholders for the arguments you want to supply later. The result is a `Closure` that runs when the remaining arguments arrive. The release page shows this example:

```php
$supportsPfa = array_filter($versions, version_compare(?, '8.6', '>='));
```

The page also says `array_map()` called with first-class callables or partial application compiles to loops, which is listed as a performance improvement.

### clamp() and SortDirection

`clamp()` restricts a value to a range and returns the nearest boundary. It works with any comparable value, including `Duration`. The documented example:

```php
var_dump(clamp(110, 0, 100)); // int(100)
```

A built-in `SortDirection` enum provides type-safe `Ascending` and `Descending` cases.

### Time\Duration and the polling API

The `\Time\Duration` class represents stopwatch-measured elapsed time. It is independent of time zones, covers more than 250 years and has nanosecond precision.

The `Io\Poll` API offers scalable I/O multiplexing using epoll, kqueue, event ports or WSAPoll, without the limits of `stream_select()`. The release page describes it as a foundation for event-loop libraries such as ReactPHP and AMPHP, so most applications will benefit through those libraries rather than by calling it directly.

### Streams, reflection and classes

- Streams can throw a `StreamException` or fail silently. Errors are structured `StreamError` objects with a `StreamErrorCode` enum, the wrapper name and the path or URL.
- Parameters can have their own DocComments, read with `ReflectionParameter::getDocComment()`.
- `ReflectionProperty::isReadable()` and `isWritable()` report whether a property can be read or written in a given scope for a given object.
- Instance readonly properties, including those in readonly classes, can declare a default value that the constructor cannot overwrite.
- `#[\Override]` can be applied to class constants and enum cases, and enums can implement `__debugInfo()`.

### Other additions

The release page also lists new `Uri\Rfc3986\UriBuilder` and `Uri\WhatWg\UrlBuilder` classes, new Sodium functions (X-Wing and ML-KEM-768 key encapsulation, SHAKE and TurboSHAKE), TLS stream session resumption and TLS 1.3 0-RTT early data, `mysqli::quote_string()`, `ZipArchive::openString()` and `closeString()`, `grapheme_strrev()`, `IntlNumberRangeFormatter`, a new `error_include_args` INI setting, and JSON error messages that include the location of the error in the input. `pack()` and `unpack()` accept `<` and `>` endianness modifiers.

## What can break: the changes to check first

The migration guide for 8.6 has these sub-pages: New Features, New Classes and Interfaces, New Functions, New Global Constants, Backward Incompatible Changes, Deprecated Features, Other Changes and Windows Support. The backward-incompatible page is the one to read before you upgrade. These are the items most likely to matter for ordinary web applications.

### Session defaults changed

This is the most likely source of surprises. According to the migration guide the INI defaults are now:

| Setting | New default | Old default | What to do if your app relies on the old one |
|---|---|---|---|
| `session.use_strict_mode` | `1` | `0` | Handlers that accept externally supplied IDs must implement `validateId()` and `create_sid()`, or set it to `0` |
| `session.cookie_httponly` | `1` | `0` | If JavaScript reads the session cookie, set it to `0` |
| `session.cookie_samesite` | `"Lax"` | unset | For cookies needed on cross-site POST, set `"None"` and set `session.cookie_secure` to `1` |

Custom session handlers deserve a closer look. The release page says handlers that do not implement both `create_sid()` and `validateId()` are deprecated. The guide adds that `SessionHandler::validateId()` is new, so a subclass declaring it without a return type gets a deprecation notice, and a subclass that overrides `open()` without calling `parent::open()` keeps its old behavior but emits a warning when an ID is validated.

Also note that with `session.lazy_write` enabled and a handler implementing `SessionUpdateTimestampHandlerInterface`, sessions that are empty and stay empty now call `updateTimestamp()` instead of `write()`. A handler that relied on `write()` receiving empty data, for example to destroy the session, must move that logic into `updateTimestamp()`. `session_encode()` returns an empty string for an empty session instead of `false`.

The security direction is sensible, but an app behind a payment redirect, a single sign-on hop or an embedded widget is exactly where SameSite `Lax` can drop the cookie. Test those flows specifically.

### Magic properties and string functions

- `??` and `empty()` on magic properties no longer call `__get()` when `__isset()` has already written the property. The guide's example returns `from __isset()` in 8.6, where earlier versions returned `from __get()`.
- `trim()`, `ltrim()` and `rtrim()` now strip the form feed character (`\f`) by default. The guide shows `trim("\f hello \f")` returning `"hello"`.
- `unpack()` reads `<` or `>` directly after a format code as an endianness modifier. The guide's example `unpack('s<value', "\x01\x00")` returns the key `value` with the value 1, where earlier versions returned the key `<value`.
- `preg_grep()` returns `false` instead of a partial array when PCRE fails, for example with malformed UTF-8 and the `u` modifier.
- `base_convert()`, `bindec()`, `hexdec()` and `octdec()` raise a notice when they cannot convert precisely.

### Stricter argument checks

Many functions now throw `ValueError` where they used to truncate silently. The guide lists NUL bytes in the first argument of `getenv()` and `putenv()`, in the file-status functions such as `file_exists()`, `is_file()` and `filesize()`, in `parse_str()` and `proc_open()` (`cwd`), plus out-of-range values for `number_format()` (`decimals`), `sleep()` and `usleep()`. If your code passes untrusted strings to these functions, expect new exceptions in logs where previously there was silent misbehavior.

### Extension-specific changes

Check this list against the extensions you use: DOM properties documented as read-only are now `public private(set)`; `ZipArchive::extractTo()` and `addGlob()` throw `TypeError` for wrong argument types; serializing a `ZipArchive` throws; Sodium password-hash functions throw `ValueError` instead of `SodiumException` for out-of-range arguments; Phar archives are auto-interpreted on include only when `.phar` is the filename extension; MBString data tables moved to Unicode 18.0; and `PDO_PGSQL` resets session state, including `SET` settings and temporary tables, when the last PDO object using a persistent connection is destroyed.

### Deprecations to clear now

Deprecations do not stop code running, but they show up as notices and will become removals later. The release page lists, among others:

- `return` inside `finally`.
- The mbstring regex functions such as `mb_ereg()` and `mb_split()`; use PCRE with the `u` modifier.
- `is_double()`, `is_long()`, `is_integer()` and `doubleval()`; use `is_float()`, `is_int()` and `floatval()`.
- `spl_object_hash()`; use `spl_object_id()`.
- Passing objects to `array_walk()`, `http_build_query()` and some other functions; use `get_object_vars()` first.
- `strcoll()` and `SORT_LOCALE_STRING`; use the intl `Collator` class.
- A third argument to `define()`.
- More than 16 filters in a `php://filter` URL unless `filter.max_filter_count` is set.
- Using `let` or `is` as class, function or constant names.

## A safe upgrade plan

### 1. Inventory what you run

Record the current PHP version and the extensions in use, on every server and container image.

```bash
php -v
php -m
```

The first command prints the version and build; the second lists loaded modules. For PHP-FPM, also confirm which binary the service uses, because a server can have several versions installed side by side.

### 2. Make deprecations visible in staging

On a staging copy, set error reporting so that deprecations are not hidden.

```ini
error_reporting = E_ALL
display_errors = On
log_errors = On
```

Use `display_errors = Off` on anything reachable by real users and read the log instead. Run the automated tests and click through the flows that use sessions, file uploads, ZIP handling, PostgreSQL and any code that calls the functions listed above.

### 3. Check the dependencies

Update your dependencies with your package manager and read each package's release notes for 8.6 support. Libraries that declare a PHP version ceiling will block the install until they release a compatible version. A WordPress site needs its theme and plugins to support 8.6, which the plugin authors, not PHP, decide.

### 4. Pin and test the session behavior

Before changing anything in production, decide on purpose which of the three session defaults you want. Either accept the safer defaults and test, or set the old values explicitly in `php.ini` or `ini_set` and plan to migrate later. Setting them explicitly also documents the choice for the next person.

```ini
; Only if the application needs the old behavior; the new defaults are safer
session.use_strict_mode = 0
session.cookie_httponly = 0
```

### 5. Upgrade in stages with a rollback path

Move one non-critical environment first, then a canary, then the rest. Keep the previous PHP packages or image tag so rollback is a configuration change. After switching the PHP-FPM or Apache module, restart the service so that the old version is not still serving requests, and confirm with `php -v` on the command line and a phpinfo page or `PHP_VERSION` output from the web server, because the CLI and web versions can differ.

## Verifying the upgrade

- `php -v` prints a version starting with 8.6.
- The web SAPI reports the same version, not only the CLI.
- Logs show no new `Deprecated` lines for code you own.
- Login, logout, and any flow that crosses sites keep their session.
- Scheduled jobs run, because cron uses the CLI binary and may use a different php.ini.

## Troubleshooting

### Users are logged out after redirects

Symptom: a user returns from an external payment or sign-on page and is asked to sign in again. Likely cause: `session.cookie_samesite` is now `Lax`, so the cookie is not sent on a cross-site POST. Fix: if the POST really must carry the session, set the value to `"None"` and enable `session.cookie_secure`, which requires HTTPS.

### JavaScript can no longer read the session cookie

Likely cause: `session.cookie_httponly` is now `1`. Fix: preferably stop reading the cookie in JavaScript and use a separate token; if you must keep it, set the option to `0`.

### Custom session handler warnings or failures

Likely cause: strict mode is now on and the handler lacks `validateId()` and `create_sid()`. Fix: implement both, or set `session.use_strict_mode` to `0` as the migration guide allows.

### New ValueError or TypeError in logs

Likely cause: a function now rejects NUL bytes, out-of-range numbers or a wrong option type. Fix: validate input before calling the function and correct the type of options passed to `ZipArchive` and `deflate_init()`.

### Extension fails to load

Compiled extensions must be built for 8.6. Install the matching package for your distribution or build from the vendor's release, then confirm with `php -m`.

## Upgrade checklist

- Read the release page and the migration guide pages for 8.6.
- Confirm your hosting, distribution or image offers 8.6.0.
- Update dependencies and check platform requirements.
- Run tests and staging with `E_ALL` and deprecations logged.
- Decide the three session settings explicitly and test cross-site flows.
- Replace deprecated functions listed above.
- Upgrade in stages, keep the old version for rollback, restart services and verify the web SAPI version.
- If you run 8.2, finish before 31 Dec 2026.

## What we checked

- Opened the PHP 8.6.0 release announcement on php.net on 2026-11-20; it states a release date of November 19, 2026 and lists the features and deprecations summarized above.
- Opened the php.net supported versions page on 2026-11-20 and copied the dates for branches 8.2 to 8.6 into the table; the page showed "Today: 20 Nov 2026".
- Cross-checked the session default changes between the release announcement (strict mode and httponly enabled, SameSite `Lax`) and the migration guide's Backward Incompatible Changes page, which also gives the old values; they agree.
- Opened the migration guide index and confirmed the eight sub-page titles listed in this article.
- Documented outputs reproduced from the migration guide: `trim("\f hello \f")` gives `string(5) "hello"` as of 8.6.0, and `clamp(110, 0, 100)` gives `int(100)` per the release page.
- Not checked: we did not install or run PHP 8.6, did not test any framework, CMS or extension on it, and did not verify availability of 8.6 packages or Docker images. Not every item on the full change log is covered here.

Last tested: 2026-11-20

## References

- PHP 8.6.0 release announcement: https://www.php.net/releases/8.6/en.php
- Supported versions: https://www.php.net/supported-versions.php
- Migration guide 8.6: https://www.php.net/manual/en/migration86.php
- Backward incompatible changes in 8.6: https://www.php.net/manual/en/migration86.incompatible.php
- ChangeLog for PHP 8.6: https://www.php.net/ChangeLog-8.php#PHP_8_6

## Frequently asked questions

### When was PHP 8.6 released and how long is it supported?

The php.net release page announces PHP 8.6.0 with a release date of November 19, 2026. The supported versions page lists active support until 31 Dec 2028 and security support until 31 Dec 2030.

### Will PHP 8.6 break my sessions?

It can. PHP 8.6 changes three session defaults: session.use_strict_mode is now 1, session.cookie_httponly is now 1 and session.cookie_samesite is now Lax. Custom session handlers must implement validateId() and create_sid() or set strict mode to 0, and JavaScript that reads the session cookie will stop working unless httponly is set to 0.

### Should I upgrade from PHP 8.2 to 8.6 directly?

PHP 8.2 security support ends on 31 Dec 2026 according to php.net, so plan a move soon. A direct jump is possible, but read the migration guides for each minor version in between and test with error reporting set to E_ALL, because deprecations accumulate across versions.

### What is the safest way to try PHP 8.6?

Run your test suite and a staging copy of the site on 8.6 with display of deprecations turned on, then fix what is reported before touching production. Keep the old PHP version installed so you can switch back.

