Upgrading PHP itself is easy. The hard part is that code written for older versions stops working afterwards: your own customisations, purchased modules, templates. Here is what we fix most often — with examples from our own upgrades.
01
Non-static methods called statically
Event handlers and class methods declared without static but called statically. In PHP 8 this is a fatal error.
function OnBuildGlobalMenu()
static function OnBuildGlobalMenu()
From our work: in an online store, a single handler like this kept the admin panel from opening, and the bonus-points Bitrix agents had been silently failing since October 2023.
02
Curly braces for string offset access
The $str{0} syntax was removed in PHP 8.0. A file containing such a line fails to load entirely — along with everything declared in it.
$path{$len-1}
$path[$len-1]
From our work: in a payment module, one such line crashed the card payment form — the customer saw an error at the very last step.
03
Passing null and wrong types
count(), in_array() and string functions no longer tolerate null, or arrays where a string is expected. What used to be a warning is now an error.
count($arResult["ITEMS"])
count($arResult["ITEMS"] ?? [])
Where it occurs: component templates, result_modifier.php, form handlers.
04
Removed functions and old syntax
each(), create_function(), the reversed argument order of implode() and other things that raised warnings for years have been removed in PHP 8.
while (list($k, $v) = each($arr))
foreach ($arr as $k => $v)
Where it occurs: old modules and customisations from the PHP 5 era.
05
Encoded modules
Modules protected with ionCube run only on the PHP versions their author encoded them for. Such code cannot be fixed — you need a new version from the developer or a replacement.
From our work: during a trial switch, a store’s filter module refused to load — we caught it on the copy, not on the live site.
06
Cron, CLI and extensions
The site runs on the new PHP, but scheduled tasks still run on the old one from the command line. Or the required extensions are not enabled in the new version: mysqli, mbstring, gd.
From our work: one store’s site ran on PHP 8.2, but all 1C-Bitrix cron jobs were launched on 7.4 and crashed — Bitrix agents and mailings had stalled.