Help! problem with upgrade to php 8

HI, besides Backlight I am still using TTG Gallery as plugin for my soccersite. Since my internetprovider upgraded PHP from 7.4 to 8.x I have an error which seems to boil down to one small bit of code. I’m not an programmer, so is there anyone in this community that could lend me a hand?
It’s this functiom and the more precisely the syntax ‘$matches [2]{0}’

function _doHeaders_callback_setext($matches) {
# Terrible hack to check we haven’t found an empty list item.
if ($matches[2] == ‘-’ && preg_match(’{^-(?: |$)}’, $matches[1]))
return $matches[0];

	$level = $matches[2]{0} == '=' ? 1 : 2;
	$block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
	return "\n" . $this->hashBlock($block) . "\n\n";
}

Please help

thnx in advance,
Saam

Hi Saam,

You’re using the old TTG Gallery Lightroom plug-in? Or CE4 Gallery?

Those are no longer supported.

I think your best option is to see if you can revert to php 7.4. You may be able to do this on your own from your host’s C-panel.

Either that or convert your soccer site to Backlight.

As the primary PHP developer of our products, that code snippet is not in a style that I have ever used. Are you running any other software on your server such as Wordpress?

Edit: it looks like that code is related to Markdown. It doesn’t seem to be in anything we’ve released from CE4 onwards.

Hi Ben.

The snippet is from a file called markdown.php which is part of either CE3 Gallery or CE3 Auto index. I no nothing about PHP, so perhaps you have a suggestion for a workaround?

thnx in advance
Saam

Hi @Saam, using braces for array indexes is not supported in PHP 8.0.0 or newer. This error can probably be fixed by replacing the braces in array references that look like this {0} and {1} so that they become [0] and [1]. I doubt that we have used the older syntax in our own code (I personally have never used it), so this should be limited to third-party code such as Markdown.

It’s quite likely though that you’ll run into further compatibility issues. If you do then you may need to change back to PHP 7.4.