# Upgrading PHP 8.1 to 8.4: The Changes That Actually Bite

By PHP Patch Assurance · Last updated: 2026-11-20

PHP 8.1 reached end of life on 31 Dec 2025: no security fixes, from anyone, ever again. The realistic targets are 8.4 (supported until 31 Dec 2028) or newer. Three branches of change separate them. Most of it is additive; the items below are the backward-incompatible changes and deprecations from the PHP project's own migration guides that actually break running code.

## 8.1 to 8.2: dynamic properties wake up

The headline change: creating dynamic properties on a class that does not declare them is deprecated in 8.2. Code that does `$obj->newField = $x` on an ordinary class starts logging deprecations and will fail in a future version. Fix it properly by declaring the property; the `#[\AllowDynamicProperties]` attribute is the documented opt-in when dynamic properties are genuinely the design. Also deprecated: the `${var}` style of string interpolation — use the `{$var}` form instead. And a quiet behavioral change: the string case functions (`strtolower`, `strtoupper`, `str_ireplace` and relatives) are no longer locale-sensitive — they convert ASCII only — and `str_split('')` now returns an empty array instead of an array holding one empty string.

## 8.2 to 8.3: the quiet step

8.3 is mostly additions — typed class constants, `json_validate()`, dynamic class constant access — that old code can ignore. The one deprecation to grep for: calling `get_class()` or `get_parent_class()` with no argument. Pass the object explicitly and the warning is gone. If a three-branch jump scares you, this is the branch to pause on: it proves the test suite works on the new line before the 8.4 changes arrive.

## 8.3 to 8.4: signatures and resources

Implicitly nullable parameters are deprecated: `function f(Thing $x = null)` must become `function f(?Thing $x = null)` or `function f(Thing|null $x = null)`. Older frameworks and plugins are full of the old form — it is a warning in 8.4, not a fatal, but it fills logs and becomes an error later. Across the extensions, resources finished migrating to objects, so `is_resource()` checks on handles returned by extension functions must become object or `false` checks. `exit()` and `die()` now behave like functions and throw a TypeError on invalid argument types instead of casting. The GMP class is final. And one operational trap: MySQLnd reports MySQL server wait timeouts with error code 4031 instead of 2006 for MySQL 8.0.24 and above — monitoring that matches on 2006 goes blind.

## Run the jump safely

Work branch by branch in staging — 8.2, then 8.3, then 8.4 — running the test suite and a staging crawl at each step with deprecations logged. Deprecations are the migration guide written against your own code: each one names a line that will break in a later version. Keep the rollback image or snapshot from each step (see [rolling back safely](/guides/rollback-php-update)), and do the production swap with the [no-downtime pattern](/guides/patch-php-without-downtime): build and verify while the old version serves, swap in seconds, health-check, and only then call it done.

## Frequently asked questions

### Can I jump straight from 8.1 to 8.4 in one step?

Technically yes, and for a small, well-tested codebase it can be the fastest route. The risk is diagnosis: when something breaks you are searching three branches of changes at once. Stepping through staging branch by branch costs hours and buys certainty about which change bit you.

### What breaks most often in practice?

The two deprecations: dynamic properties (8.2) and implicitly nullable parameters (8.4), because both patterns were idiomatic in older code and in the long tail of plugins. Both are warnings before they are fatals — which is precisely why they get ignored until they are fatals.

### Why 8.4 and not 8.5 or 8.6?

8.4 is the conservative target: security support until 31 Dec 2028 and the widest library compatibility today. If your dependencies already support them, 8.5 (security until 31 Dec 2029) or 8.6 (until 31 Dec 2030) buys a longer runway for the same work — see <a href='/guides/php-release-lifecycle'>the lifecycle dates</a>.
