BuzzPHP

PHP 8.6 Upgrade Checklist: What Changed, Steps

Upgrade PHP 8.5 to 8.6: new features with examples, deprecations, new session defaults, support dates and a checklist for Composer, CI and Docker.

UpgradesBy BuzzPHPPublished

On this page

PHP 8.6.0 came out on November 19, 2026. To move from PHP 8.5, read the changes below that touch your code, run your tests on 8.6 with deprecations visible, and pay particular attention to the new session defaults. PHP 8.6.0 removes no extensions. If you only need the security fixes released the same day, install the latest patch of your current branch instead: see our CVE-2026-126714 session vulnerability guide. Coming from 8.4? Our PHP 8.5 upgrade checklist covers that step.

The sources for this page are the PHP 8.6 release announcement, the 8.5 to 8.6 migration guide and the UPGRADING notes in the 8.6.0 source tag. Read them for your own extensions; this checklist selects what we think matters most.

Support dates for PHP 8.6

php.net's supported versions data gives these dates:

Branch Released Active support until Security support until
8.6 Nov 19, 2026 Dec 31, 2028 Dec 31, 2030
8.5 Nov 20, 2025 Dec 31, 2027 Dec 31, 2029
8.4 Nov 21, 2024 Dec 31, 2026 Dec 31, 2028
8.2 Dec 8, 2022 Dec 31, 2024 Dec 31, 2026

PHP 8.2 loses security support at the end of this month. If you still run it, see our PHP 8.2 end of life guide.

New features worth knowing

Partial function application. A ? placeholder in a call returns a closure that takes the remaining arguments. See the RFC.

$atLeast86 = version_compare(?, '8.6', '>=');
var_dump($atLeast86('8.5.13')); // bool(false)

clamp(). Returns the value if it is in range, otherwise the nearest bound. It throws a ValueError if the minimum is above the maximum (RFC).

echo clamp(110, min: 0, max: 100); // 100

Time\Duration. An elapsed-time value independent of any time zone, with nanosecond precision (RFC). Durations are comparable, so min() and clamp() accept them.

use Time\Duration;

$timeout = Duration::fromSeconds(1)->add(Duration::fromMilliseconds(100));
$capped = min($timeout, Duration::fromSeconds(30));

Readonly property defaults. No new syntax: the old compile-time rejection of a default value is lifted (RFC).

final class Settings
{
    public readonly int $retries = 3;
}

SortDirection enum. A shared type with Ascending and Descending cases, so libraries can stop inventing their own flags (RFC).

function orderBy(string $column, SortDirection $dir = SortDirection::Ascending): string
{
    return $column . ($dir === SortDirection::Ascending ? ' ASC' : ' DESC');
}

Polling API. Io\Poll watches many streams with the best mechanism the platform offers (epoll, kqueue, event ports or WSAPoll) instead of stream_select(). It targets event-loop libraries such as ReactPHP and AMPHP more than application code (RFC).

use Io\Poll\{Context, Event};

$poll = new Context();
$poll->add(new StreamPollHandle($server), [Event::Read]);
foreach ($poll->wait() as $watcher) {
    // handle $watcher->getHandle()
}

The upgrade notes list more: enum __debugInfo(), #[\Override] on class constants, a stream errors API, extra URI builders, and TLS session resumption options for OpenSSL streams.

Backward-incompatible changes to test first

The UPGRADING notes list far more than fits here. These are the ones most likely to affect an application:

  • Session defaults. session.use_strict_mode is now 1, session.cookie_httponly is now 1 and session.cookie_samesite is now Lax (RFC). JavaScript that reads the session cookie, custom handlers that accept externally supplied IDs, and cross-site POST flows that depend on the cookie need an explicit setting.
  • trim(), ltrim(), rtrim() now strip the form feed character by default.
  • preg_grep() returns false instead of a partial array when PCRE fails, for example on malformed UTF-8 with /u.
  • fclose(), file_put_contents() and copy() return false when flushing or closing fails. Previously the failure was ignored, so code that never checked the result may now see errors.
  • NUL bytes. Many functions (the file_exists() family, getenv(), parse_str(), proc_open()'s $cwd and others) throw a ValueError for strings containing NUL bytes.
  • Phar. A file is treated as a Phar archive on include only if .phar appears as an extension in the file name component, not in a directory name.
  • array_intersect() converts values to strings while scanning, which can change warnings and __toString() call order.
  • unpack() reads < or > right after a format code as an endianness modifier, which changes keys such as s<value.
  • SplFileObject next(), fgets() and seek() have different caching and end-of-file behavior, and DOM properties documented as readonly now use asymmetric visibility, so the error message for a write changes.

Deprecations to clear

Run your suite with error_reporting set to E_ALL and look for these (RFC for most):

  • return inside finally, and returning a value from __construct() or __destruct().
  • Naming things let, is or readonly, using _ or namespace as a constant name, and a third argument to define().
  • is_double(), is_long(), is_integer() and doubleval(): use is_float(), is_int() and floatval().
  • spl_object_hash() (use spl_object_id()), spl_classes(), metaphone() and strcoll().
  • Passing objects to array_walk(), http_build_query() and mb_convert_variables(); convert with get_object_vars() first.
  • Mbregex in mbstring, mysqli_get_charset(), mysqli_stmt_init(), and several ArrayIterator, SplFileObject CSV and Reflection methods.
  • Session handlers: classes implementing SessionHandlerInterface without create_sid() and validateId() now trigger a deprecation.

Ini and extension changes

The removed-extensions section of the notes is empty. On the ini side, error_include_args is new and off by default, mysqli.default_port is range-checked, mbstring.detect_order now takes effect when changed at runtime, and the three session defaults above changed. The mbstring Unicode tables moved to Unicode 18.0 and Fileinfo to file 5.48, so custom magic databases must be regenerated.

The upgrade checklist

  1. Record your baseline. Capture php -v, php --ini and php -m on the current runtime, and on the one that serves web requests. They can differ.
  2. Check Composer. On 8.6, run composer prohibits php 8.6 and composer check-platform-reqs --lock. If composer.json sets config.platform.php, change it deliberately, because it tells Composer which version to resolve for (Composer docs). Update blocked packages and review the lockfile diff.
  3. Run static analysis. Run PHPStan, Psalm or Rector at the new target and fix deprecated calls from the list above.
  4. Extend the CI matrix. Add 8.6 as a non-blocking job first, keep your current version as the required job, then promote 8.6 when it passes with deprecations shown.
  5. Check extensions. Confirm each extension in your baseline php -m output loads on 8.6, including PECL ones. Do not assume a package exists for the new version.
  6. Update Docker images. The official php image publishes 8.6 tags (8.6-cli, 8.6-fpm, 8.6-apache and Alpine variants). Pin an exact patch tag, rebuild and redeploy every container.
  7. Test the session flows. Log in, log out, remember-me, uploads and any widget that reads the session cookie, with the new defaults.
  8. Roll out with a way back. Keep the previous image or package and lockfile. After release, watch error logs and worker output before declaring it done.

Reviewed on December 6, 2026 against php.net.

FAQ

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

PHP 8.6.0 was released on November 19, 2026. php.net lists active support until December 31, 2028 and security support until December 31, 2030.

What breaks most often when moving from PHP 8.5 to 8.6?

For many web applications it is the new session defaults: strict mode and the HttpOnly flag are now on, and the SameSite attribute defaults to Lax. Code that reads the session cookie from JavaScript or relies on cross-site POST requests carrying it needs an explicit setting. Deprecation notices are the next most common finding.

Does PHP 8.6 remove any extensions?

No. The 8.6 upgrade notes have an empty section for removed extensions and SAPIs. Mbregex in the mbstring extension is deprecated, though, because the Oniguruma library it uses is no longer maintained.

Do I have to move to 8.6 to get the November 2026 security fixes?

No. The same security fixes shipped in 8.2.36, 8.3.37, 8.4.28 and 8.5.13 on the same day. Patch your current branch first and schedule the 8.6 migration separately.

Related guides