The Warranty Is Expiring
Few things on a website are as invisible as the version of PHP running underneath it. Nobody asks about it. Nobody compliments it. It is the footing of the building: essential, buried, and completely ignored until something cracks.
This month, something is about to crack. PHP 8.2 reaches end of life on December 31, 2026. After that date the PHP project ships no more security patches for it. Not one. The roof warranty has expired, and the forecast calls for rain.
So I did what any responsible person does with a deadline four weeks away. I made coffee, opened the migration notes, and started reading. Then I made more coffee.
The obvious move is to jump straight to PHP 8.4. It has security support through the end of 2028, and skipping 8.3 means one disruption instead of two. One renovation, one dumpster in the driveway. What follows is what I learned on the way, presented in the view as an architect.
The Punch List
Every renovation has a punch list. PHP’s is called the migration guide, and it is longer than you would like.
Implicitly nullable parameters. This is the big one. For years PHP let you write a typed parameter with a null default, and quietly assumed you meant “or null.” PHP 8.4 now raises a deprecation notice for every one of these. Older code is full of them. Your log file will look like a submittal that came back covered in red ink.
// Before: PHP shrugs and allows it
function setOwner(User $owner = null) {}
// After: say what you mean
function setOwner(?User $owner = null) {}
The fix is one character. Multiplied by a few hundred functions, it is still one character, just with more feelings attached.
E_STRICT is gone. The error level was removed and the constant is deprecated. PHP stopped emitting it years ago, but plenty of config files still say E_ALL & ~E_STRICT, like a sign on a door to a room that was demolished in 2020.
exit() grew up. exit() and die() now behave more like real functions. Pass them the wrong type and you get a TypeErrorinstead of a polite shrug.
Smaller cracks. Several functions, including round() and some mbstring calls, now throw ValueError on bad input. A few DOM methods throw exceptions where they used to return false. Some resources became objects, so is_resource() checks quietly stop working. None of these are dramatic. All of them are the kind of thing you find at 4:45 on a Friday.
The Subcontractors Who Didn’t Show Up
Your own code is the easy part. You wrote it, or at least someone on payroll did. The trouble is everything else on the jobsite.
Extensions that moved out. PHP 8.4 removed four extensions from the core: IMAP, OCI8, PDO_OCI and Pspell. They still exist, but now live in PECL, so you install them separately. If your site reads a mailbox with imap_open(), that line simply stops working after the upgrade. The IMAP library underneath had not been updated since 2018, so this is less an eviction than a condemned-building notice. A maintained package such as Webklex/php-imap is the better long-term fix.
Third-party scripts. Plugins, themes, and that social network script you bought in 2019 all have to be ready too. Some vendors are quick. Some are on what I call “geological time.” Before you change anything, check each one’s stated PHP support. Assume nothing. Verify everything. It is a spec, after all.
The host. Shared hosting control panels often offer the new version before the extensions you need are compiled for it. Switching versions is a dropdown. Switching back is also a dropdown, which is the most comforting thing I can say about shared hosting.
The New Kitchen
It is not all demolition. Skipping from 8.2 to 8.4 means you collect two releases’ worth of upgrades at once.
From PHP 8.3 you get typed class constants, a json_validate() function, and the #[\Override] attribute, which catches you when you think you are overriding a parent method and are actually just talking to yourself.
PHP 8.4 brings the headline features. Property hooks let a property carry its own get and set logic, so a lot of boilerplate getter and setter methods can simply go away. Asymmetric visibility lets a property be public to read but private to write. Think of it as a window: everyone can look in, nobody can climb through. There are also handy new array functions like array_find(), and you can finally write new Thing()->doSomething() without wrapping it in extra parentheses.
None of these are required on day one. But it is nice to know the renovation comes with better cabinets.
Substantial Completion
Here is the sequence I would follow, in the order a good project manager would want it:
- Take a full backup of files and database. Then confirm the backup actually restores. A backup you have never restored is a theory.
- List every extension and third-party script the site uses, and check each one’s PHP 8.4 support.
- Stand up a staging copy and switch it to 8.4 first. Never test on the occupied building.
- Turn on full error logging, including deprecations, and click through everything. Logins, forms, uploads, email.
- Fix the implicit nullables and any
E_STRICTreferences. Tools like Rector and PHPCompatibility can find most of them for you. - Reinstall anything that moved to PECL, or replace it.
- Schedule the production switch for a quiet hour, with the rollback dropdown in view.
The PHP upgrade will never be glamorous. No one will tour your server and admire the new footing. But four weeks from now, the sites that made the move will keep getting security patches, and the ones that didn’t will be standing in the rain with an expired warranty.
Upgrade the foundation. Then go enjoy the kitchen.
…and now for something completely different.
Allodoxaphobia is the fear of other people’s opinions. It’s a rare social phobia characterized by an irrational and overwhelming fear of what other people think.
