Sanniv Khare 8 min read

PHP 8.6 lands 19 Nov: what WordPress plugins should change

PHP 8.6 lands 19 Nov: what WordPress plugins should change

PHP 8.6.0 is planned for Thursday 19 November 2026; the current build is 8.6.0RC7, announced on php.net on 12 November. The short answer for WordPress: core is ready. We ran a scan for every 8.6 deprecation over a fresh WordPress 7.1.4 download and found one hit, in a bundled third-party library. The risk sits in plugins: a plugin that declares its own global clamp() without a function_exists() guard will stop loading on 8.6, because clamp() is now a built-in function. Search your plugins for that first.

Why we did this: ideaxecution.com runs on WordPress with our own Paperkite plugin, which replaced about 20 third-party plugins, and we build Laravel apps for clients. Every PHP release lands on our code before it lands on anyone else’s.

This post covers the 8.6 changes from the official UPGRADING notes and RFCs, plus a scan of WordPress core we ran on a Linux test server (Ubuntu 24.04). It is written from RC7 and will be updated on release day.

What WordPress 7.1.4 core looks like under PHP 8.6

We downloaded WordPress 7.1.4 from wordpress.org (1,512 PHP files) and ran the scan script below over it.

Terminal output of php86-scan.sh over WordPress 7.1.4

Real output from our test server: one deprecated call in core, inside the bundled getID3 library.

  • is_integer() in wp-includes/ID3/module.audio-video.quicktime.php, line 321. PHP 8.6 deprecates is_integer(), is_long(), is_double() and doubleval() in favour of is_int() and is_float() (RFC). It is a deprecation notice, not an error, and getID3 is an upstream library that core updates from time to time.
  • spl_object_hash() appears only in two doc comments in wp-includes/plugin.php. Core switched the hook system to spl_object_id() in 7.1.0, which is exactly what 8.6 asks for.
  • clamp() is already handled. wp-includes/compat.php ships a polyfill, added in 7.1.0, wrapped in if ( ! function_exists( 'clamp' ) ). On PHP 8.6 the built-in function exists, so the polyfill is skipped.
  • Sessions: core never calls session_start() (the only two hits are Site Health strings telling you not to), so the new session defaults below do not touch core itself.

The change that can take a site down: clamp()

The clamp RFC adds clamp(mixed $value, mixed $min, mixed $max): mixed to core PHP. It returns $value when it is inside the range, otherwise the nearest bound, and throws a ValueError when $min is greater than $max or either bound is NAN.

Because the name is now taken, any plugin or theme that declares a global function clamp() without a guard fails at load time with a “cannot redeclare” fatal error. Helpers named clamp are common in themes, page builders and image plugins.

clamp() polyfill in WordPress core next to an unguarded plugin helper

The fix is either the guard WordPress uses, or a prefixed or namespaced name. A namespaced function (MyPlugin\clamp()) does not clash with the global one.

// before: fatal on PHP 8.6
function clamp( $v, $lo, $hi ) {
    return max( $lo, min( $hi, $v ) );
}

// after: use the built-in when it exists
if ( ! function_exists( 'clamp' ) ) {
    function clamp( $v, $lo, $hi ) {
        return max( $lo, min( $hi, $v ) );
    }
}

One difference to keep in mind: the built-in throws a ValueError when $min > $max. A userland helper that silently returned something in that case will now throw, so check call sites that build bounds from settings.

Deprecations most likely to show up in plugins

These are the 8.6 deprecations from the UPGRADING file, section 4 that we expect to meet in WordPress plugins and Laravel apps. All of them raise E_DEPRECATED in 8.6 and are planned for removal in PHP 9.

Deprecated in 8.6 Use instead Source
is_double(), is_long(), is_integer(), doubleval() is_float(), is_int(), floatval() RFC
spl_object_hash() spl_object_id() RFC
spl_classes() ReflectionExtension::getClassNames() RFC
strcoll(), SORT_LOCALE_STRING Collator::compare(), Collator::sort() RFC
metaphone() a userland phonetic library RFC
mysqli_get_charset(), mysqli::stmt_init() mysqli_character_set_name(), prepare() RFC
mbstring regex (mb_ereg*) PCRE (preg_*) RFC
SplFileObject CSV methods (fgetcsv, fputcsv, …) see the RFC for replacements RFC
Objects passed to http_build_query(), array_walk() get_object_vars() first RFC
Third argument to define() drop it RFC
Returning a value from __construct() or __destruct() return nothing RFC
return inside a finally block move the return out RFC
__debugInfo(): ?array __debugInfo(): array UPGRADING
More than 16 filters in one php://filter URL stream_filter_append() RFC

The deprecations RFC also proposed deprecating list(); that vote did not reach the two-thirds majority and it is not in the UPGRADING notes, so list() stays.

Behaviour changes that do not raise a notice

Some 8.6 changes alter results without any warning, which makes them easier to miss than a deprecation:

  • Session defaults (RFC): session.use_strict_mode is now 1, session.cookie_httponly is now 1 and session.cookie_samesite is now Lax. A plugin that uses native PHP sessions and relies on cross-site POSTs (a payment gateway returning to the site, for example) or reads the session cookie from JavaScript should be tested. session_encode() now returns an empty string instead of false for an empty session.
  • trim() now strips form feed (\f) by default, along with ltrim() and rtrim() (RFC). This matters only if you parse data where a form feed is meaningful.
  • fclose(), file_put_contents() and copy() now return false when the final flush or close fails. Code that treated a non-false return as success becomes more accurate, but check any === false branches that used to be dead code.
  • New ValueErrors for out-of-range arguments, for example an invalid $mode in array_filter() or out-of-range $decimals in number_format() (UPGRADING, section 1).

The scan script

The script is a set of grep patterns, one per deprecation. It lists counts and the first three hits for each. Patterns that would need a parser (objects passed to array_walk(), return in finally) are left out; review those by hand.

#!/usr/bin/env bash
# php86-scan.sh: list PHP 8.6 deprecations in a plugin or app tree
dir="${1:-.}"
check() {
  n=$(grep -rnE --include='*.php' "$2" "$dir" | wc -l)
  printf '%-28s %s\n' "$1" "$n"
  [ "$n" -gt 0 ] && grep -rnE --include='*.php' "$2" "$dir" | head -3 | cut -c1-110
}
check "is_double/is_long/..."  '\b(is_double|is_long|is_integer|doubleval)\s*\('
check "spl_object_hash()"      '\bspl_object_hash\s*\('
check "spl_classes()"          '\bspl_classes\s*\('
check "strcoll()"              '\bstrcoll\s*\('
check "SORT_LOCALE_STRING"     '\bSORT_LOCALE_STRING\b'
check "metaphone()"            '\bmetaphone\s*\('
check "mysqli get_charset"     '\bmysqli_get_charset\s*\(|->get_charset\s*\('
check "mysqli stmt_init"       '\bmysqli_stmt_init\s*\(|->stmt_init\s*\('
check "mb_ereg* (mbregex)"     '\bmb_(ereg|eregi|regex)[a-z_]*\s*\('
check "SplFileObject CSV"      '[-]>(fgetcsv|fputcsv|setCsvControl|getCsvControl)\s*\('
check "__debugInfo(): ?array"  'function\s+__debugInfo\s*\(\s*\)\s*:\s*(\?array|array\s*\|\s*null)'
check "unguarded clamp()"      '^function\s+clamp\s*\('
check "session_start()"        '^[^*/]*\bsession_start\s*\('

Run it on wp-content/plugins and wp-content/themes, then on anything flagged run the plugin with WP_DEBUG and WP_DEBUG_LOG on under PHP 8.6 to see the notices in context. The ->fgetcsv style patterns can match unrelated objects with the same method names, so read each hit.

Laravel 13 apps

The same script works on a Laravel app: run it on app/ for your own code and on vendor/ to see which packages still need a release. Two points specific to Laravel:

  • Laravel handles sessions through its own drivers (file, database, Redis) rather than PHP’s native session_start(), so the new session.* ini defaults do not change a standard Laravel app. Packages in vendor/ that start native sessions are the exception.
  • Check composer.json constraints before switching the CLI and FPM versions. A package pinned to php: "~8.5.0" will block composer install on 8.6 even if its code is fine.

What is new and worth using

  • Partial function application (RFC): ? stands for one argument, ... for the rest, and the result is a Closure. For example array_map(str_replace('hello', 'hi', ?), $arr).
  • clamp(), covered above.
  • Time\Duration (RFC), a SortDirection enum (RFC), grapheme_strrev() and readonly properties with default values (RFC).
  • JSON error positions: json_last_error_msg() and JsonException now say where the error is (php.watch).

A WordPress plugin that supports older PHP versions cannot use partial application or the new classes directly, because they are syntax and symbols the older versions do not have. clamp() is the exception: core’s polyfill makes it safe to call on any PHP version WordPress 7.1 supports.

What to check on your own site

  1. Run the scan over wp-content/plugins and wp-content/themes, and fix any unguarded global clamp() first.
  2. Turn on WP_DEBUG_LOG on a staging copy with PHP 8.6 and load every admin screen your plugins add.
  3. If a plugin uses native sessions, test logins and any payment or OAuth return flows with the new SameSite=Lax default.
  4. For Laravel, run the scan on app/ and vendor/, then composer update --dry-run under 8.6 to find blocking constraints.

PHP 8.6 gets active support until the end of 2028 and security fixes until the end of 2030 (php.watch), so there is no rush to switch on release day. There is every reason to know where your plugins stand before your host offers it.

Made by the team behind this post

Apps from our studio

  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.