Upgrading from PHP 8.2 to 8.4: what breaks and how to fix it

Last checked [date] · [X] min read

PHP 8.2 security support ends December 31, 2026. After that date, new vulnerabilities in 8.2 won't be patched.

[Intro: who this guide is for, the two-jump path through 8.3, and how long the upgrade typically takes for a mid-sized app. Two or three sentences.]

Before you start

  1. Make sure your test suite passes on PHP 8.2 today.
  2. Turn on deprecation warnings in your test environment so nothing is hidden.
  3. Check that your framework and key packages support 8.4.

Implicitly nullable parameters are deprecated

In PHP 8.4, giving a typed parameter a default of null without marking the type nullable raises a deprecation. Make the type explicitly nullable.

Before
function save(User $user = null) { ... }
After
function save(?User $user = null) { ... }

[Next breaking change]

[What changed, which version changed it, how to find it in your code, and the fix, with a before-and-after example like the one above.]

Framework and package compatibility

[Minimum versions of Laravel, Symfony and common packages that support PHP 8.4, each linked to its official release notes.]

Upgrade checklist

  • Tests pass on 8.2 with deprecations visible
  • Dependencies updated to 8.4-compatible versions
  • Deprecations fixed
  • Tests pass on 8.4, staging deploy checked

Sources

[Official PHP migration guides for 8.3 and 8.4, framework release notes.]