When calling the_excerpt() within a single post that refers to a post (that no longer exists) on a Custom Post Type Archive page I get the following warning from includes/templates-functions.php line 462
Attempt to read property "post_type" on int wp-content/plugins/easy-digital-downloads/includes/template-functions.php:462 edd_after_download_content() wp-includes/class-wp-hook.php:324 apply_filters('the_content') wp-includes/formatting.php:3992
Information (if a specific version is affected):
PHP Version: 8.3.6
EDD Version (or branch): 3.2.12
WordPress Version: 6.5.2
Any other relevant information:
The edd_after_download_content() function calls global $post which usually returns an object, but it seems when the post is not found it returns an int of the post ID in reference which is causing the error on this check in the function:
if ( $post && $post->post_type == 'download' ...
I have patched this function on my installation to remove the global call and use get_ functions to get the post ID and post type check.
As far as I have tested, the purchase buttons still appear at the end of single downloads but I haven't tested further than that:
Bug Report
When calling
the_excerpt()
within a single post that refers to a post (that no longer exists) on a Custom Post Type Archive page I get the following warning fromincludes/templates-functions.php
line 462Attempt to read property "post_type" on int wp-content/plugins/easy-digital-downloads/includes/template-functions.php:462 edd_after_download_content() wp-includes/class-wp-hook.php:324 apply_filters('the_content') wp-includes/formatting.php:3992
Information (if a specific version is affected):
PHP Version: 8.3.6
EDD Version (or branch): 3.2.12
WordPress Version: 6.5.2
Any other relevant information:
The
edd_after_download_content()
function callsglobal $post
which usually returns an object, but it seems when the post is not found it returns anint
of the post ID in reference which is causing the error on this check in the function:if ( $post && $post->post_type == 'download' ...
I have patched this function on my installation to remove the global call and use
get_
functions to get the post ID and post type check.As far as I have tested, the purchase buttons still appear at the end of single downloads but I haven't tested further than that: