Error when editing text block after updating to Kirby 3.9

After updating to 3.9, I attempted to edit content written inside of a both text block and title block (inside a Blocks field) in the panel. I received the following error:

Using ${var} in strings is deprecated, use {$var} instead

I’ve since updated to 3.9.1, and I still receive the same error. Any guidance on how to diagnose / address this issue? I’ve been using MAMP to work on the site locally, but a recent update forced me onto PHP 8.2, could this be related?

Edit: It looks like I missed that this error is actually more widespread, keeping me from being able to make any updates at all in the panel.

That has certainly to do with the PHP version, but I have a feeling that this comes from a plugin you are using? Have you updated your plugins? Which ones are you using? Or custom code?

More information about the deprecation:
https://php.watch/versions/8.2/${var}-string-interpolation-deprecated

1 Like

I’m using

I’ll try disabling each one and seeing if I can narrow it down, for now.

One thing I’ve noticed after coming back to this today – it seems that my edits are actually applied to my site’s content, despite the error message and the appearance that the edits were not applied (save / revert bar is still along the bottom and the pencil icon / ‘unsaved changes’ dropdown is still in the toolbar at the top).

After narrowing it down, it seems that AutoID is the issue, as suspected.

I’m pretty reliant on this plugin to achieve a specific feature request for a client, however. @texnixe – would you be able to provide guidance how I might update the plugin myself? It seems like a relatively minor syntax change, but maybe I’m underestimating the change required?

Are you already using the latest version of the plugin?

Yes, I am

I did a quick text search in the plugin and all the instances of this error are in the AutoIDDatabase.php file. So you can do a search and replace in that file.

Note that Kirby has built-in UUIDs since Kirby 3.8, I don’t know if this plays well with the plugin. What are you using it for?

I’m using it solely to generate UUIDs for structure field entries. That is intended as a Kirby feature, but is not yet implemented, is that correct?

Yes, that’s right.

An alternative to changing the source code of the plugin would be to downgrade to PHP 8.1.

1 Like

Since the changes required seem fairly limited, I think I’m going to update the plugin’s code for now.

Can you confirm for me that I understand correctly what to change? In a line like the following:

foreach ($this->database->query("SELECT * FROM AUTOID WHERE autoid = '${autoid}'") as $obj)

I would change ${autoid} to {$autoid}?

yep

This seems to have worked, but I’ve immediately bumped into a new error caused by a different deprecation regarding dynamic properties. Would it be best to create a separate post in the forum for help with this?

It might be easier to turn deprecation warnings off in your php error settings.

1 Like

It might be easier to turn deprecation warnings off in your php error settings.

I’ve done this, thanks for your help!