Critical Error
-
I’m seeing a recurring PHP 8 fatal in
Better_Search_Core_Query::posts_pre_query()on a client site, triggered whenever another plugin runs a WP_Query withfields => 'ids'. In this case it’s FacetWP’s renderer, but I’d expect it to fire for any plugin or theme that does the same. Confirmed on the current version of Better Search. Deactivating Better Search resolves the fatals, so the plugin is definitively the source.PHP Fatal error: Uncaught Error: Attempt to assign property “score” on int in
/wp-content/plugins/better-search/includes/class-better-search-core-query.php:12330 Better_Search_Core_Query->posts_pre_query() 1 WP_Hook->apply_filters() 2 apply_filters_ref_array() [class-wp-query.php:3226] 3 WP_Query->get_posts() [class-wp-query.php:3958] 4 WP_Query->query() [class-wp-query.php:4090] 5 WP_Query->__construct() [facetwp/includes/class-renderer.php:400] 6 FacetWP_Renderer->get_filtered_post_ids() [class-renderer.php:146] 7 FacetWP_Renderer->render() [class-request.php:185] 8 FacetWP_Request->update_query_vars()
… 13 WP->query_posts() → WP->main() → wp() → index.php
FacetWP calls
WP_Querywithfields => 'ids'(seeclass-renderer.php:400), soposts_pre_queryreceives an array of integer post IDs rather than WP_Post objects. Line 1233 then does something like$post->score = …, which is a fatal on PHP 8+ (silent warning on PHP 7).
You must be logged in to reply to this topic.