Fixing an illegal offset type error in THESIS theme

A bowl of bananas

Recently we have updated PHP on our server from 5.2 to 5.4. Everything went perfectly. But then we found out that our blog which runs on WordPress completely broke down.

After fixing most of the bugs, we got this peculiar bug:
Warning: Illegal string offset ‘type’ in wp-content/themes/thesis_183/lib/admin/options_post.html"reason">Reason:

The piece of code responsible for this issue(which laid in wp-content/ themes/thesis_183/lib/admin/options_post.html'type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {


To solve the issue we replaced the previous line with following line

if ((is_array($meta_field['type'])) && ($meta_field['type']['type'] == 'checkbox') && is_array($meta_field['type']['options'])) {


The issue was created because the latest version of PHP create error when [type] field doesn't contains an array.

comments powered by Disqus