Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
PHP 8 throwing out old plugin STW
Hello there dear community. I haven’t been here for a few years.
My hosting company has kindly upgraded PHP version from 7.4 to 8.1
It threw a few problems, most of which I was able to resolve by reverting to PHP7.4, upgrading from TXP 4.8 to the latest 4.8.8 and then pushing back to PHP8.1
BUT two of my websites are using the ~19 year old plugin STW_Category_Tree which throws the following error message:
Fatal error: Array and string offset access syntax with curly braces is no longer supported in mydomain/textpattern/plugins/stw_category_tree/stw_category_tree.php on line 79
Is there a hack to the plugin which won’t come back to bite me in a year or two? (sure, no crystal balls. Something relatively future-safe)
- or -
Is there a straightforward way to replace the plugin with either a more up-to-date plugin or native functionality?
As someone who never was a developer, I also haven’t touched textpattern for close to a decade, except for annual upgrades – so please be gentle with your advice :)
Thanks!
Offline
Re: PHP 8 throwing out old plugin STW
Welcome back!
The simple hack if you want to get the plugin working is to find all the line numbers that it complains about and alter anything that looks like:
someArray{0}
and replace it with:
someArray[0]
I don’t know offhand any plugins that offer equivalent functionality to that one, sorry. But you should be able to use core tags to get some or all of the way there nowadays.
Edit: ha, see etc’s post below, for example :)
Last edited by Bloke (2023-03-02 22:49:16)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: PHP 8 throwing out old plugin STW
Hello, welcome back. I don’t know what exact functionality you need, but try
<txp:category_list children wraptag="ul" break="li" />
This should output the whole category tree, and you can restrict it by parent/categories/etc with few extra attributes.
Offline
Re: PHP 8 throwing out old plugin STW
Thanks @Bloke.
I actually tried editing the plugin in the plugin section of the admin side, before posting here, but when saving, I got the following error
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@mydomain to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
But after your response, I noticed that I can upload a php file of the plugin (don’t recall that being an option in the ‘olden’ days). Editing the plugin offsite and uploading it sorted my problem.
This now buys me time to experiment with @Etc’s steer.
Thank you both for the quick and helpful response!!
Offline