Jump to content
thirty bees forum

Tips for preparing your theme for PHP 8.1


musicmaster

Recommended Posts

1. Make sure you have the latest version of Thirty Bees and the modules

Why bother with error messages that are solved in later versions?

2. Make the fixes under PHP 7.4

The show-stopping errors under PHP 8.1 are warnings under PHP 7.4. So it is much easier to fix them there. You just need to take the trouble to look in the error log of the server. Don't be lazy and fix all the problems that you find here.

The worst that can happen this way is that your site is one minute offline when you upload a fix with a syntax error. And that can always be fixed quickly by going back to the original.

Even PHP 8.0 is less strict than 8.1. So use that if you aren't allowed to go back to 7.4.

After you switch to a lower PHP version you should empty the cache. 

3. Smarty compiled files can be read

Smarty "compiles" the template (".tpl") files into a kind of php files that can be found under the /cache/smarty/compile directory. The errors happen in this compiled version. For example:

/cache/smarty/compile/fe/8c/6b/fe1_0.file.breadcrumb.tpl.php

When you open such files in a text editor you will see that they are rather lightly processed versions of the original (in this case breadcrumb.tpl). At the top of such a file you will find a link to the original file. In this case the original is rather obvious, but note that their is no path in the compiled file name. So when you have an error in for example "view.tpl" you really need to look at the top of this compiled file to see the source.

Next there is the line number. The line number in this compiled file is not the same as that in the original tpl file. Often it works to subtract 2 from the number (the compiled files have an extra header of two lines). If not you will have to use your creativity. search for variable names and other characteristic text to find the problematic line.

4. Look what Thirty Bees did

Themes are very similar. So there is a good chance that Thirty Bees encountered the same problems that you see with your theme and solved them. So if you are not sure how to solve a bug you can have a look at the same file in the Niara or the Community Theme theme and look how it was solved there.

5. Look how I solved it for Panda

In this post you will find how I solved it for Panda. It provides some explanation about what the problems are and how they are solved.

Edited by musicmaster
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Great stuff. I also recommend using php7.4 and fix all those issues there. 

I just want to remind everyone that if you are on 1.4 you can use collectlogs module to track those issues in summarized way, without the need to search inside php log files. The module will show you both paths to compiled template file, and to source file as well.

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...