Fix CherryFramework PHP Fatal Error for when upgrading from PHP 5/6 to PHP 7

Welcome back to KickstartCommerce.com! As with much of life, especially when it’s concerning WordPress, errors seem to appear in threes or bunches at a time.

Last week, it was a jQuery conflict error, and this week Bluehost forced the same customer’s hand by auto upgrading their website from PHP 5.2 directly to PHP 7.

Truth be told, the customer was forewarned a few times about how PHP 5.X was outdated and full of security issues that would no longer be supported in favor of having the customer migrated to PHP 6 or PHP 7.

As glitchy as WordPress is when doing simple tasks such as a theme or plugin update, I knew it was nothing but trouble to have upgraded from PHP 5 directly to PHP 7.😳

I loaded the customer’s website in the browser and soon discovered that a Cherry Framework plugin was the culprit. Often times, authors can be a bit lazy on updating legacy themes and plugins to work with the latest WordPress core or PHP updates.

And so, this given customer’s website loaded the dreadful message:

You website has encountered a fatal error.

That’s all the home page stated and that an email was sent to the administrator. But what is the exact fatal error encountered, and where and how do I locate this fatal error? 🤔

Enter error logs. Thank goodness for errors, because it held the next clues in helping me troubleshoot this issue. The easier solution would have been to find a web hosting provider that offered PHP 5 hosting, but again, that’s the easy and most INSECURE option. 😳

Nevertheless, I located, downloaded, and viewed the error log to discover where at exactly within the site architecture the PHP Fatal error was occurred:

PHP Fatal error: ‘continue’ not in the ‘loop’ or ‘switch’ context in /your/path/public_html/wp-content/plugins/cherry-plugin/includes/widgets/widgets-manager.php on line 563

But still, what does this mean? 🤔   Good question, I was in the dark until reviewing line 563 in widgets-manager.php. I found the line and the code, and still in the dark.

So, now what? Well, I dig a bit deeper into the toolbox of tricks to search for ‘widgets-manager.php’ using command line scripting (of you could download the entire site codebase and run a local search using Sublime), which returned the following file and path:

/public_html/wp-content/plugins/cherry-plugin/includes/plugin-assets.php

There in the opening lines, lines 5-9, I discovered the following lines of code:

And being the experimental genius, rather daredevil I am, I simply commented out those very lines to see what would happen (as shown below).

After all, you can’t go much more wrong than the existing PHP Fatal error, right? 😁   To my surprise, commenting out those 4-5 lines of code in the plugin-assets.php file did the trick, and the website has been humming along ever since.

Now, don’t go asking me all the details behind why commenting out a cherry framework plugin for widgets manager would cause a website to fatally crash. My guess is the code isn’t up to snuff, rather the code needs to be updated to work with the latest versions of WordPress core codebase and PHP 7.

For now though, I’m happy that the customer is happy and back online realizing sales. And I hope this solution does the same for you and your website!

Let me know if you have any questions, or need additional assistance to troubleshoot your issue. Thanks and that’s all for now!

Share:
Written by Alvin Brown
He's an experienced and passionate serial entrepreneur, founder and publisher of Kickstart Commerce. Alvin possesses a great love for startups dominating their market using profitable digital strategies for greater commerce.