PHP 8.5 deprecates a batch of old habits that are everywhere in WordPress plugins: curl_close(), finfo_close(), the $http_response_header variable, the (double) and (boolean) casts, and case 'x'; with a semicolon. The takeaway: casts, case ...; and reads of $http_response_header are reported as soon as PHP compiles the file, before any of its code runs, so they show up in the log on every request that loads that file. The *_close() calls only report when they actually run. And if (function_exists('http_get_last_response_headers')) around a fallback read does not silence the warning; assigning the variable first does.
We tested this with a small sample plugin on a Linux test server: PHP 8.3.6 (CLI) and PHP 8.5.12 (the WebAssembly build that WordPress Playground uses, @php-wasm/node 3.1.64). Then we scanned the current wordpress.org releases of 20 popular plugins with a 37-line tokenizer script.
Why we did this: we run WordPress sites with our own Paperkite plugin on PHP 8.5, and the support forums for Wordfence and the Matomo connector filled up with exactly these notices this year. We wanted a repeatable way to find them before the error log does.
The sample plugin: nine notices on PHP 8.5
The plugin is a fake feed importer with one function per deprecated pattern. On PHP 8.3.6 it prints its results without a single notice. On PHP 8.5.12 the same file gives nine:

Real output from our test server, messages shortened.
The order matters. The first four notices (lines 24, 28, 20 and 33) were printed before the plugin’s first echo: they are compile-time deprecations. The other five arrive interleaved with the output, at the moment each line runs. In practice that means:
- Compile-time (casts,
case ...;, reading$http_response_header): any request that loads the file logs them, even if the function is never called. These are the ones that flood a log. - Runtime (
curl_close(),finfo_close(),nullas an array offset,$str++on a non-numeric string,chr()outside 0 to 255): only the request that runs that line logs them. A@in front of the call hides them, which is why some plugins stay quiet.
The full list of 8.5 deprecations, each with its RFC section, is in the PHP 8.5 UPGRADING notes and the deprecations RFC. WordPress core’s own status is in PHP 8.5 support in WordPress 6.9.
The fixes, and the one that is not a fix

The fixed plugin produces the same output on PHP 8.3.6 and 8.5.12, and zero notices on 8.5.
Most replacements are mechanical:
| Deprecated in 8.5 | Replace with | Works on |
|---|---|---|
(double), (integer), (boolean), (binary) |
(float), (int), (bool), (string) |
every PHP 7 and 8 |
case 'rss'; |
case 'rss': |
every version |
curl_close($ch), curl_share_close() |
nothing, or unset($ch) |
handles are objects since PHP 8.0 |
finfo_close($fi) |
nothing, or unset($fi) |
finfo is an object since 8.1 |
imagedestroy(), xml_parser_free() |
nothing | objects since 8.0 |
$arr[null], array_key_exists(null, ...) |
'' as the key |
every version |
$code++ on "a9" |
str_increment($code) |
8.3 and newer |
chr(300) |
chr(300 % 256) |
every version |
If your plugin still supports PHP 7.4, keep the close call behind a version check. That branch is never taken on PHP 8, so it never reports:
if (PHP_VERSION_ID < 80000) {
curl_close($ch);
}
The $http_response_header trap
http_get_last_response_headers() only exists from PHP 8.4. The obvious backward-compatible version still warns on 8.5:
// Still deprecated on PHP 8.5: the fallback line is
// compiled even when the first branch returns.
if (function_exists('http_get_last_response_headers')) {
return http_get_last_response_headers() ?? [];
}
return isset($http_response_header) ? $http_response_header : [];
We ran exactly this and got the notice for the last line. What stays quiet is the pattern Guzzle adopted: assign the variable yourself before reading it, so PHP treats it as an ordinary local.
$body = file_get_contents($url, false, $context);
if (function_exists('http_get_last_response_headers')) {
$http_response_header = http_get_last_response_headers();
}
$headers = $http_response_header ?? [];
Setting it to null before the request (as the old Guzzle 3 code does) is also quiet in our test. Capturing it by reference in a closure, function () use (&$http_response_header), and reading it inside is not: that is the Guzzle 6 pattern, and it reports on 8.5.
A scanner that reads tokens, not text
A grep for curl_close also matches comments, docblocks and method names such as $this->curl_close(). This script uses PHP’s tokenizer, so it only reports real calls, real casts and real variable reads. It runs on PHP 7.4 and newer, so you can run it on the server you have today, before you switch versions.
<?php
// php85-scan.php <dir>: find PHP 8.5 deprecations with the tokenizer
// (comments and strings are ignored). Runs on PHP 7.4 and newer.
$casts = ['(double)', '(integer)', '(boolean)', '(binary)'];
$funcs = ['curl_close', 'curl_share_close', 'finfo_close',
'imagedestroy', 'xml_parser_free', 'mysqli_execute',
'socket_set_timeout'];
$hits = [];
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($argv[1]));
foreach ($it as $f) {
if (substr($f, -4) !== '.php') continue;
$t = @token_get_all(file_get_contents($f));
$n = count($t);
for ($i = 0; $i < $n; $i++) {
$tok = $t[$i];
if (is_array($tok)) {
$txt = strtolower(str_replace([' ', "\t"], '', $tok[1]));
if (in_array($txt, $casts, true)) $k = "cast $txt";
elseif ($tok[0] === T_VARIABLE && $tok[1] === '$http_response_header') $k = '$http_response_header';
elseif ($tok[0] === T_STRING && in_array(strtolower($tok[1]), $funcs, true)) {
$j = $i + 1;
while ($j < $n && is_array($t[$j]) && $t[$j][0] === T_WHITESPACE) $j++;
$prev = $i - 1;
while ($prev >= 0 && is_array($t[$prev]) && $t[$prev][0] === T_WHITESPACE) $prev--;
$isDecl = $prev >= 0 && is_array($t[$prev]) && in_array($t[$prev][0], [T_FUNCTION, T_OBJECT_OPERATOR, T_DOUBLE_COLON], true);
$k = ($j < $n && $t[$j] === '(' && !$isDecl) ? strtolower($tok[1]) . '()' : null;
} else $k = null;
if ($k) $hits[$k]["$f:{$tok[2]}"] = 1;
} elseif ($tok === '`') {
$hits["backtick shell_exec"]["$f:" . ($t[$i-1][2] ?? 0)] = 1;
$i++; while ($i < $n && $t[$i] !== '`') $i++;
}
}
}
ksort($hits);
foreach ($hits as $k => $list) printf("%-24s %4d\n", $k, count($list));
if (getenv('LIST')) foreach ($hits as $k => $list) foreach (array_keys($list) as $l) echo "$k $l\n";
Run it on one plugin, or on the whole folder, and add LIST=1 for file and line numbers:
php php85-scan.php wp-content/plugins/my-plugin
LIST=1 php php85-scan.php wp-content/plugins/my-plugin
It does not catch case ...;, null offsets, string increments or chr() ranges: those depend on values, not tokens. The compile-time ones (case ...;) do show up the first time PHP 8.5 loads the file, so a staging site with WP_DEBUG_LOG on catches the rest.
20 popular plugins, scanned
We downloaded the current releases of 20 popular plugins from wordpress.org on 21 Nov 2026 and ran the scanner on each. Thirteen had no hits at all: Akismet 5.7.2, All-in-One WP Migration 7.113, Classic Editor 1.7.0, Contact Form 7 6.2.5, Yoast Duplicate Post 4.7, Jetpack 16.4, LiteSpeed Cache 7.9.3, Redirection 5.10.1, Regenerate Thumbnails 3.1.6, WooCommerce 11.3.1, Yoast SEO 28.9, WP Super Cache 3.1.5 and WPForms Lite 2.0.5.1. None of the 20 uses a non-canonical cast or a backtick.

Hits are what the scanner found; “review” is what was left after we read every hit by hand.
A hit is not automatically a notice. We read all 48 and sorted them:
- Guarded by a version check (never runs on PHP 8): all 6 in Really Simple SSL (
unset()on PHP 8,curl_close()in theelse), most of UpdraftPlus’s own code (version_compare(PHP_VERSION, '8.0', '<')), the bundled Monolog and newer Guzzle copies, and Elementor’simagedestroy()behindis_resource(). - Silenced with
@: W3 Total Cache’s@curl_close()in its S3-compatible client and@finfo_close()in its MIME helper. - The Guzzle 7 assignment pattern for
$http_response_header: clean, as tested above (WP Mail SMTP, W3 Total Cache, Site Kit). - Left to review, 15 lines in total: Elementor’s
xml_parser_free()in the WXR import parser; Wordfence’sxml_parser_free()in the firewall’s XML-RPC parser; Site Kit’sgtg/measurement.php(onecurl_close(), one$http_response_headerread); five unguardedcurl_close()calls in W3 Total Cache (its HTTP helper, the Azure CDN client, the Closure Compiler minifier and two in the bundled SNS request library); and in UpdraftPlus, its bundled Google API stream client (two reads), a bundled Guzzle 6.5.5 (the closure pattern, plus twocurl_close()calls) and an old Guzzle 3curl_close().
Most of these sit on paths that run rarely (an import, a backup to remote storage, a CDN purge), so a site can run for weeks before the notice appears. Each is a one-line change for the plugin’s authors, and a deprecation is only a notice: nothing breaks on 8.5. They become errors only when a future PHP removes the function.
What to check in your own plugin
- Run
php85-scan.phpon your plugin folder, withLIST=1. - For each hit, check whether it sits behind
PHP_VERSION_ID < 80000(or< 80100forfinfo_close()). If not, delete the close call or guard it. - Replace every
$http_response_headerread with the assign-first pattern above. - Load every admin screen and run every scheduled task once on a PHP 8.5 staging copy with
WP_DEBUG_LOGon, then count the notices:grep -c 'PHP Deprecated' wp-content/debug.log. - If you ship bundled libraries (Guzzle, AWS SDK, Google API client), update them before patching them: recent Guzzle 7 releases already handle 8.5.
If you only want to see the notices without touching a server, @php-wasm/node runs PHP 8.5 inside Node and is enough to reproduce everything in this post.



