Dragon Upgrade Breakage Forecast For PHP Wordpress Plugin - Rating, Reviews, Demo & Download
Plugin Description
Your host wants you on a newer PHP version. Before you change it, you want one answer: will my site still work?
Pick the PHP version you plan to move to, press Start scan, and the checker reads every plugin, must-use plugin and theme on your site. Then it gives you:
- One verdict for your site: “Ready for PHP 8.4”, “Ready for PHP 8.4, with deprecation notices to clean up”, or “Not ready for PHP 8.4”. When a file or a plugin could not be checked, or a scan did not finish, it says so instead of “Ready”.
- One verdict for each plugin and theme, worst first, with how many problems will break it and how many are only deprecation notices.
- What to do first: the active plugins and themes that will break, each with its next step. “An update is available: update, then scan again”, “Not from WordPress.org: ask whoever maintains it”, or “Contact the author with the findings below”.
- The detail behind every finding: the file and line, a plain-words explanation, the message PHP itself prints, a suggested fix and a link to the PHP manual.
Inactive plugins and themes are scanned too, but listed apart and left out of the site verdict, so an old plugin you never use does not hold you back.
It checks for PHP 8.1, 8.2, 8.3, 8.4 and 8.5, and on a site that runs PHP 7.4 it includes the PHP 8.0 changes as well.
What it checks
Will break (a fatal error, or code that stops working as intended):
- Functions PHP 8.0 removed, such as
each(),create_function(),money_format()andget_magic_quotes_gpc(). - Calls with too few arguments, such as
mktime()with none orparse_str()with one. - Old syntax PHP 8.0 no longer compiles: the
(real)and(unset)casts,$text{0}offsets, nested ternaries without parentheses, the__autoload()function andparent::in a class without a parent. - Classes and functions named with words PHP reserved for itself (
mixed,match,never). - PHP 4 style constructors, which PHP 8.0 no longer calls.
- Calling a non-static method statically.
- Replacing the whole
$GLOBALSarray, which PHP 8.1 no longer allows. $php_errormsg, which PHP 8.0 no longer fills in.
Deprecated, still works (PHP writes a notice to the error log, and a later version is expected to remove it):
- Dynamic properties: storing a value in an object property the class never declares (PHP 8.2).
- Parameters with a type and a
nulldefault that do not say the type may be null (PHP 8.4). - Methods of classes that implement a built-in interface such as
ArrayAccess,CountableorIterator, or extend a built-in class, without the return type PHP 8.1 added to the method they override. - Classes that implement
Serializablewithout__serialize()and__unserialize()(PHP 8.1). - Deprecated functions, such as
strftime(),utf8_encode(),libxml_disable_entity_loader(),curl_close()andimagedestroy(). - Deprecated constants, such as
FILTER_SANITIZE_STRING,E_STRICTand somePDO::driver constants. - Deprecated ways of calling a function, such as
get_class()with no argument orfgetcsv()without its escape argument. ${var}inside strings, and callbacks written as"self::method"orarray( 'parent', 'method' )(PHP 8.2).trigger_error()withE_USER_ERROR, and a class named_(PHP 8.4).- A required parameter after an optional one.
- The backtick shell operator, long cast names such as
(integer),case X;with a semicolon, the$http_response_headervariable andnullas an array key (PHP 8.5).
How it stays precise
A checker that cries wolf is worse than none, so this one is built to report only what PHP will really do.
- It reads code with PHP’s own tokenizer. No bundled parser, no
exec(), no outside service. It never runs the code it reads. - It understands the code around a call. A method, a static call or a function a plugin declares in its own namespace is not mistaken for a removed PHP function, and a plugin that ships its own copy of a removed function is not flagged for calling it.
- It skips code that only runs on older PHP, such as a branch behind a PHP version check, or a removed function behind a
function_exists()check. Problems PHP reports while it compiles the file are the exception: PHP reports them whether the line runs or not, so the checker does too. - Every rule was reproduced on real PHP 7.4, 8.0, 8.1, 8.2, 8.3, 8.4 and 8.5. Each one has test files that were run on those PHP versions, and where PHP prints a message, the message you see is the one it printed. A few entries for extensions the test images do not include follow the PHP manual instead (LDAP, ODBC, Enchant, PostgreSQL, mhash and XML-RPC), or PHP 8.5’s own reflection data (the MySQL and PostgreSQL PDO driver constants).
- It was tested on real plugins. 1,835 findings in 803 PHP files of the 120 most-installed WordPress.org plugins and themes (PHP 7.4 to 8.5), every one checked by hand.
What it cannot see
It reads code and never runs it, so some changes are out of its reach:
- Changes that depend on the values at run time: passing
nullto a built-in function parameter that does not accept it, losing precision when a float becomes an integer, or comparing a string with a number. - Deprecated methods on objects, such as
ReflectionProperty::setAccessible(), because the checker cannot always tell which class an object belongs to. - Deprecated argument values, such as the
HTML-ENTITIESencoding name passed tomb_convert_encoding(). - A
foreachover$GLOBALSby reference, which PHP 8.1 changed without any notice or error.
Two shapes are left out on purpose, so that nothing PHP would stay silent on is reported: a property a parent class writes when any of its subclasses declares it (PHP reports it only for objects of a class that does not declare it), and Class::method() called on a non-static method from a file’s top-level code or from a closure (PHP allows it when that code runs inside a method of the class, as a template included from one does).
Test your site on the new PHP version too, ideally on a staging copy first, and watch the error log.
Never hangs
A scan runs in short steps of a few seconds each, inside a memory budget, designed for the time and memory limits of shared hosting. You see which plugin it is checking, how many of its files are done, and how far through the plugins and themes it is. You can pause, resume or cancel at any time, and if you leave the screen, the scan carries on from where it stopped when you come back. Files over 1 MB are skipped and listed, never read. So is a file that needs more memory than the request has (the result says so, and raising memory_limit to 256M lets the checker read it) and a file that is too complex to check in one go: one with an extreme number of tokens or nesting, or one that takes too long to check on its own (10 seconds at the most).
WP-CLI
wp upgrade-breakage-forecast-for-php scan --target=8.4 scans every plugin and theme and prints the verdict and the table. `wp upgrade-breakage-forecast-for-php report` prints the last result again, and `--package=plugin:akismet` (a key from the table's Key column, or a plugin's name when no other plugin or theme has it) prints the findings of one plugin or theme. Both take `--format=table`, `json` or `csv`. A scan started from WP-CLI shows its progress on the screen too, and can be cancelled there.
The CLI often runs a different PHP version from the site itself, so the scan checks from the site’s PHP: the version recorded the last time Tools > Upgrade Breakage Forecast for PHP was opened. Pass --from=7.4 to set it yourself. If neither is known, the scan checks from the CLI’s own PHP and prints a warning. The result says “Checked the changes from PHP X to Y”.
Exit codes: 0 nothing found that will break (deprecation notices included; the Skipped column lists any files not checked), 1 not ready, 2 the scan failed, did not finish, nothing was checked, or the arguments were wrong. That makes it easy to use in a deployment script.
Site Health
A Site Health test tells you when your site runs an older PHP version than WordPress recommends and has not been scanned, when the last scan found something that will break or could not check everything, when the last scan is 30 days old or more, when it checked from a different PHP version than your site now runs, and when your site has moved on to the PHP version you checked for, so it is time to check the next one.
Export
Download every finding as a CSV file, with the plugin or theme, file, line, problem, PHP version and PHP’s message, to send to a developer or a plugin’s author.
Updating plugins to fix what it finds?
Dragon Safe Updates, a sibling plugin, takes a snapshot before every plugin and theme update and rolls a broken update back automatically.
External services
None. The scan runs entirely on your own server and nothing is sent anywhere: no account, no telemetry, no outside service. The screen links to the PHP manual, make.wordpress.org and dragoncore.ltd, and those links open only when you click them.
Screenshots
No screenshots provided
