Wordpress-seo: PHP Warning: count() Parameter must be an array or an object that implements Countable

Created on 28 Sep 2018  路  2Comments  路  Source: Yoast/wordpress-seo

  • [x] I've read and understood the contribution guidelines.
  • [x] I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

I have a warning about count() function. seems called on non array...I have catches it and generate a stack trace in order to help you to find a solution. I have found this issue on debug.log file. No warning appears on front end/back end area.

[28-Sep-2018 09:11:43 UTC] PHP Fatal error:  Uncaught ErrorException: count(): Parameter must be an array or an object that implements Countable in /www/pluginsyithemes_804/public/wp-includes/post-template.php:284
Stack trace:
#0 /www/pluginsyithemes_804/public/wp-includes/post-template.php(284): {closure}(2, 'count(): Parame...', '/www/pluginsyit...', 284, Array)
#1 /www/pluginsyithemes_804/public/wp-includes/formatting.php(3308): get_the_content('')
#2 /www/pluginsyithemes_804/public/wp-includes/class-wp-hook.php(288): wp_trim_excerpt('')
#3 /www/pluginsyithemes_804/public/wp-includes/plugin.php(203): WP_Hook->apply_filters('', Array)
#4 /www/pluginsyithemes_804/public/wp-includes/post-template.php(397): apply_filters('get_the_excerpt', '', Object(WP_Post))
#5 /www/pluginsyithemes_804/public/wp-content/plugins/wordpress-seo/frontend/class-opengraph.php(589): get_the_excerpt()
#6 /www/pluginsyithemes_804/public/wp-includes/class-wp-hook.php(286): WPSEO_OpenGraph->description('')
#7 /www/pluginsyithemes_804/public/wp-includes/class-wp-hook.php(310): WP_ in /www/pluginsyithemes_804/public/wp-includes/post-template.php on line 284

Please describe what you expected to happen and why.

I think the issue is related to a wrong variable initialization.

How can we reproduce this behavior?

I don't know, the issue appear during plugin configuration but I haven't a "step by step" to reproduce it, but seems related to opengraph class, so something related to Facebook...

Technical info

  • WordPress version: latest
  • Yoast SEO version: latest
  • If relevant, which editor is affected (or editors):
  • [x] Classic Editor
  • [ ] Gutenberg
  • [ ] Classic Editor plugin


* Which browser is affected (or browsers):
- [ ] IE11
- [x] Edge
- [x] Chrome
- [x] Firefox
- [ ] Safari

  • Relevant plugins in case of a bug:
  • Tested with theme: Twenty16

Thanks for your time!
AG

good first issue

Most helpful comment

It was an Wordpress Core Bug see this Issue https://core.trac.wordpress.org/ticket/42814

All 2 comments

It was an Wordpress Core Bug see this Issue https://core.trac.wordpress.org/ticket/42814

Thanks for your time @Julian-B90

AG

Was this page helpful?
0 / 5 - 0 ratings