Old Kirby v2.5.12 site with php errors after PHP 7.4 was turned off by the provider

I have an old Kirby 2.5.12 website which used this anchor headings plugin.

The provider switched to PHP 8. This is the error:

Whoops\Exception\ErrorException thrown with message “Array and string offset access syntax with curly braces is no longer supported”

#0 Whoops\Exception\ErrorException in […]/html/site/plugins/anchor-headings/vendor/phpQuery/phpQueryObject.php:1059

Question 1: How can i turn off the plugin? Just by commenting out everything with anchorheadings in config.php?

Question 2: I already uploaded the latest version of the plugin, but the error persists. How can i replace those curly braces?

Question 3: What is the recommended way to transfer a 2.5.12 site which relied on PHP 7 to 3.x with PHP 8.x.

Thanks!

Kirby 2 in general does not support PHP 8. It reached EOL quite a while ago. We recommend updating to Kirby 3.

The error means that the code is trying to access array or string offsets using {} instead of [], e.g.

$array = ['a', 'b', 'c'];
$firstElement = $array{0};

Instead of

$firstElement = $array[0];

Thanks a lot! I found an updated version of phpQuery that works with PHP 8 and replaced the older version within the kirby-anchor-headings plugin. For now it works again. Seems like i have to make the step to Kirby 3, but maybe I can manage to wait until Kirby 4 to make the transition.

Unfortunately this was not the only problem which came with the switch to PHP 8. I have this error message now when i try to save a page in the panel:

“method_exists(): Argument #1 ($object_or_class) must be of type object|string, int given”

Kirby Version: 2.5.14
Toolkit Version: 2.5.14
Panel Version: 2.5.14
PHP: 8.0

Installed plugins:
anchor-headings
auto-orient-images
autorename
calendar (GitHub - mzur/kirby-calendar-plugin: A plugin for the Kirby CMS to easily implement an event calendar.)
cdn
clonr
field-switch
imagekit
imageset
kirby-snippetfield
kirby-styledmap
previewer
simplemde
table

Is there a possibility to solve this in Kirby 2? I don’t have time at the moment to make the switch to Kirby 3. Thanks!

Kirby 2 reached EOL on January 1, 2021, i.e. more than 2 years ago. As I already mentioned above: Kirby 2 just does not support PHP 8, you would have to make changes to the source code to make it work, because PHP 8 came with a lot of breaking changes. And with an installation that has that many plugins installed, it will be even harder.

I’d recommend you pay your hosting service the excess fee they charge for prolonged PHP 7.4 support, if you cannot update to a newer version of Kirby now. Or if that’s not possible with your current hosting, then find another one, or set up your own server.