TwentyFifteen theme throwing illegal string errors and then site stops loading
-
Over the past 72 hours byrdnick.com has failed to load at least a dozen times.
Troubleshooting revealed the following error in the logs:
PHP Warning: Illegal string offset ‘height’ in …/wp-content/themes/twentyfifteen/inc/template-tags.php on line 116
And here is the snippet of code referred to (line 115 and 116 start with $metadata):
printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s × %4$s</a></span>', _x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ), esc_url( wp_get_attachment_url() ), $metadata['width'], $metadata['height'] ); }I’ve deleted TwentyFifteen and reinstalled it. That didn’t help.
I called my host. It does not appear the be a problem on their end.
Any advice would be helpful.
-
This topic was modified 8 years, 10 months ago by
Steven Stern (sterndata). Reason: put code in backticks
-
This topic was modified 8 years, 10 months ago by
-
The code you are referring to seems to be trying to get the meta from an image that is supposed to be on that page but something goes wrong when the functions is trying to call them.
Is there a way for you to verify or remember what image would that be and check the data stored in your database?
Best regards,
KonstantinosHello @nick_byrd,
Actually “$metadata” variable is expected to be an array but due to some reason it is receives string value and so when theme access it $metadata[‘width’] it generates an Illegal string offset error.
I think this can be due to one of the plugins related to attachment or images. Can you please disable such plugins and check ? If possible list plugins here you are using to find out which it can be.
I hope this helps.
Thanks.
-
This reply was modified 8 years, 10 months ago by
Gaurav Padia.
Hi @xkon and @gauravpadia. I’m listing the plugins I have installed below. Feel free to point out candidates to start with. Otherwise I will try to check some of them myself.
Advanced Ads
Akismet Anti-Spam
AMP (Accelerated Mobile Pages)
Anti-Malware Security and Brute-Force Firewall
Better Analytics
Featured Images in RSS w/ Size and Position
Select Frame Buster (not activated)
Jetpack by WordPress.com
Links Shortcode
Social Warfare (not activated)
Social Warfare – Pro
Spreaker Shortcode (for embedding podcasts)
UpdraftPlus – Backup/Restore
Visualizer: Charts and Graphs Lite
Wordfence Security
WP Force SSL
WP-Optimize
WP-Polls
Yoast SEO (not activated)
Yoast SEO Premium
And in case this is worth adding, I’m now noticing an error that has been occurring between the illegal string errors:
[04-Jul-2017 12:38:23 UTC] PHP Warning: Unknown user in /home1/byrdnick/public_html/wp-content/plugins/jetpack/class.json-api-endpoints.php on line 1117And this error showed up yesterday after I posted this;
[04-Jul-2017 12:02:20 UTC] PHP Warning: mkdir(): File exists in /home1/byrdnick/public_html/wp-content/mu-plugins/endurance-page-cache.php on line 218I didn’t install that plugin. I suspect that my host installed it (after some spikes in traffic that were causing performance issues).
Hi @xkon and @gauravpadia. I’m listing the plugins I have installed below. Feel free to point out candidates to start with. Otherwise I will try to check some of them myself.
Advanced Ads
Akismet Anti-Spam
AMP (Accelerated Mobile Pages)
Anti-Malware Security and Brute-Force Firewall
Google Analytics Dashboard
Featured Images in RSS w/ Size and Position
Select Frame Buster (not activated)
Jetpack by WordPress.com
Links Shortcode
Social Warfare (not activated)
Social Warfare – Pro
Spreaker Shortcode (for embedding podcasts)
UpdraftPlus – Backup/Restore
Visualizer: Charts and Graphs Lite
Wordfence Security
WP Force SSL
WP-Optimize
WP-Polls
Yoast SEO (not activated)
Yoast SEO Premium
And in case this is worth adding, I’m now noticing an error that has been occurring between the illegal string errors:
[04-Jul-2017 12:38:23 UTC] PHP Warning: Unknown user in /home1/byrdnick/public_html/wp-content/plugins/jetpack/class.json-api-endpoints.php on line 1117And this error showed up yesterday after I posted this;
[04-Jul-2017 12:02:20 UTC] PHP Warning: mkdir(): File exists in /home1/byrdnick/public_html/wp-content/mu-plugins/endurance-page-cache.php on line 218I didn’t install that plugin. I suspect that my host installed it (after some spikes in traffic that were causing performance issues). I don’t even see the plugin on my Plugin page.
-
This reply was modified 8 years, 10 months ago by
nick_byrd.
Hello @nick_byrd,
I got your email notification regarding plugin listing but not sure why I can’t see your reply right now. No problem, it is okay as I have email notification.
Actually when I checked further I believe the issue might not be due to plugins but because of your site may be running on PHP 7.1. The issue is with the wordpress function theme using and due to some PHP version 7.1 it returns empty string and generating an error. Here are the links where I saw it, like for example Advanced Ads plugin you are using they have applied fix https://plugins.trac.wordpress.org/changeset/1600191 for it but it is limited to their plugin only. The other link is where I saw it due to PHP 7.1 is https://github.com/jchristopher/attachments/issues/173. So we have to update code theme manually so that it doesn’t create an error or you can ask your host to downgrade the PHP version for your site.
I suggest to ask host to downgrade the PHP version to PHP 5, but of course please confirm with them first that your site is running on PHP 7.
I hope this helps.
Thanks.
You are right, @gauravpadia: I am running PHP 7 after all.
I just contacted my host. Here are my PHP 5 options:
PHP 5.4
All files with the extension .php will be handled by the PHP 5.4 engine.
Legacy PHP with security updates. Compatible with most environments.PHP 5.4 (Single php.ini)
Same as PHP 5.4, but all subdirectories will use ~/public_html/php.iniPHP 5.4 (FastCGI)
All files with the extension .php will be handled by PHP 5.4 FastCGI processes.
FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_suphp. This eliminates the overhead of loading the PHP interpreter on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster.PHP 5.6
All files with the extension .php will be handled by the PHP 5.6 engine.PHP 5.6 (Single php.ini)
Same as PHP 5.6, but all subdirectories will use ~/public_html/php.iniPHP 5.6 (FastCGI)
All files with the extension .php will be handled by PHP 5.6 FastCGI processes.
FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_suphp. This eliminates the overhead of loading the PHP interpreter on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster.Any idea which of these PHP 5 options would be best?
@nick_byrd, you can go with “PHP 5.6” which is default standard. Thanks.
Done. Thanks! I’ll come back in 24 hours to report whether I am still receiving these errors. If I’m not, I’ll be sure to mark this as resolved (and give @gauravpadia credit).
@nick_byrd Thanks 🙂
I seem to be still getting the error despite switching to Php 5.6
[07-Jul-2017 14:47:37 UTC] PHP Warning: Illegal string offset 'width' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 115 [07-Jul-2017 14:47:37 UTC] PHP Warning: Illegal string offset 'height' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 116 [07-Jul-2017 16:34:18 UTC] PHP Warning: Unknown user in /home1/byrdnick/public_html/wp-content/plugins/jetpack/class.json-api-endpoints.php on line 1117 [09-Jul-2017 00:46:11 UTC] PHP Warning: Illegal string offset 'width' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 115 [09-Jul-2017 00:46:11 UTC] PHP Warning: Illegal string offset 'height' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 116 [09-Jul-2017 07:26:59 UTC] PHP Warning: Illegal string offset 'width' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 115 [09-Jul-2017 07:26:59 UTC] PHP Warning: Illegal string offset 'height' in /home1/byrdnick/public_html/wp-content/themes/twentyfifteen/inc/template-tags.php on line 116Hello @nick_byrd,
Sorry my suggestions didn’t solved your issue.
Now I think there may be issue with one of the image in your media library but it is difficult to find when you have large number of images. Like for example see this site link which is using same twentyfifteen theme – https://willowpraise.org/pastors-page/follow-up-letter-58/ you can see same as your error. Now click next image link at top and you will see image without any error. The error is only for one image on above link. So I believe this is the same thing for you too.
I think you would need some professional to inspect your website and solve the issue. If you want me to hire then you can directly contact me amplebrain[a]gmail.com
Thanks.
-
This reply was modified 8 years, 10 months ago by
The topic ‘TwentyFifteen theme throwing illegal string errors and then site stops loading’ is closed to new replies.