ahmedkaludi / schema-and-structured-data-for-wp

Creating the best Structured Data and Schema plugin for WordPress
http://structured-data-for-wp.com/
72 stars 32 forks source link

Uncaught TypeError: count() #2160

Closed ashmatadeen closed 1 week ago

ashmatadeen commented 1 month ago

When using the schema type 'Recipe' (and possibly other schema types too), the page throws a fatal PHP error on the front end. From the logs:

appserver_1        | NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /app/web/wp-includes/post-template.php:324
appserver_1        | Stack trace:
appserver_1        | #0 /app/web/wp-content/plugins/schema-and-structured-data-for-wp/output/class-saswp-output-service.php(8883): get_the_content()
appserver_1        | #1 /app/web/wp-content/plugins/schema-and-structured-data-for-wp/output/output.php(2956): SASWP_Output_Service->saswp_get_featured_image()
appserver_1        | #2 /app/web/wp-content/plugins/schema-and-structured-data-for-wp/output/function.php(336): saswp_schema_output()
appserver_1        | #3 /app/web/wp-content/plugins/schema-and-structured-data-for-wp/output/function.php(138): saswp_get_all_schema_markup_output()
appserver_1        | #4 /app/web/wp-includes/class-wp-hook.php(324): saswp_schema_markup_output('')
appserver_1        | #5 /app/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
appserver_1        | #6 /app/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
appserver_1        | #7 /app/web/wp-includes/general-template.php(3050): do_action('wp_head')
appserver_1        | #8 [internal function]: wp_head()
Sanjeevsetu commented 3 weeks ago

Hi @ashmatadeen

We will add this fix in next milestone