I updated this website to PHP 8.0.13 and WordPress 6.3.1, and it fell over with “There Has Been a Critical Error on Your Website”. Rolling back to WordPress 6.1.3 did not help.
Debug
In wp-config.php
, I changed (temporarily):
1 |
define( 'WP_DEBUG', false ); |
to:
1 2 3 4 5 |
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', true ); |
That sees logging in debug.log
in directory wp-content
.
Diagnose
The log reported:
1 2 3 |
PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in ...\pilgrem.com\wwwroot\wp-content\plugins\crayon-syntax-highlighter\util\crayon_util.class.php:71 |
The documentation for implode
explained that the following legacy signature had been removed as of PHP 8.0.0:
1 |
implode(array $array, string $separator): string |
The valid signature swapped the arguments:
1 |
implode(string $separator, array $array): string |
Fix
Line 71 of crayon_util.class.php
was not the only instance of implode
still using the legacy signature. A search of the code identified another instance. Swapping the order of the arguments fixed the problem.