The Trouble with abandoned WordPress Themes, Part 1: Incompatibility with PHP 7.4

Reading Time: 2 minutes

As a blogger at the DirTeam.com / ActiveDir.org Weblogs, I love the way my blog The Things That Are Better Left Unspoken looks. However, the theme I use is an abandoned theme and hasn't been updated in the last ten years. In my defense: It was current when I started blogging fourteen years ago…

WordPress is a dynamic platform and relies heavily on PHP and MySQL. These components need to be upgraded, too, to achieve the highest level of information security.

The change du jour

Today's change was an upgrade of the PHP: Hypertext Preprocessor extensions to Internet Information Services (IIS) on our Windows web servers.

Immediately after implementing a new version in the 7.4.x branch, the blog The Things That Are Better Left Unspoken began to throw a PHP warning:

PHP Warning: count(): Parameter must be an array or an object that implements Countable in /wp-content/themes/metro-master/loop.php on line 41

Other blogs behaved fine. This lead to one conclusion: the theme is broken.

Our change

We searched a bit and found a solution. In the theme's loop.php file, we replaced the text that read:

<?php if (count(get_the_tag_list())): ?>

With the text:

<?php if (is_array(get_the_tag_list()) && count(get_the_tag_list())): ?>

Going forward

We notified the author of the theme on our change. We created an issue on the theme's GitHub, so we can help others who may encounter the same issue.

Today, we found that the maintainer has updated the loop.php file on GitHub, according to our specifications.

Thank you.

Author: Sander Berkouwer

Sander Berkouwer is the author of the Active Directory Administration Cookbook, speaker and blogger at DirTeam.com and ServerCore.net. He is awarded Microsoft MVP, Veeam Vanguard and VMware vExpert. Since 2009, Microsoft has awarded Sander with the Most Valuable Professional (MVP) award. Since 2016, Veeam has awarded Sander with the Veeam Vanguard award.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.