I am trying to: operate a website normally
Link to a page where the issue can be seen: it's in the PHP error logs. Error log reads:
```
28-Jun-2022 02:21:40 UTC] PHP Fatal error: Uncaught Error: __clone method called on non-object in /code/web/wp-content/plugins/wp-views/embedded/inc/wpv.class.php:1549
Stack trace:
#0 /code/web/wp-includes/class-wp-hook.php(307): WP_Views->wpv_set_current_post(NULL)
#1 /code/web/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#2 /code/web/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#3 /code/web/wp-content/plugins/wp-views/embedded/inc/wpv-filter-query.php(326): do_action('wpv_action_wpv_...', NULL)
#4 /code/web/wp-includes/class-wp-hook.php(307): WPV_View_Post_Query->wpv_get_view_query_results('')
#5 /code/web/wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters('', Array)
#6 /code/web/wp-includes/plugin.php(474): WP_Hook->do_action(Array)
#7 /code/web/wp-admin/admin-ajax.php(202): do_action('wp_ajax_nopriv_...')
#8 {main}
thrown in /code/web/wp-content/plugins/wp-views/embedded/inc/wpv.class.php on line 1549
```
I expected to see: not an error
Instead, I got: an error
the function wpv_set_current_post reads
```
function wpv_set_current_post( $current_post ) {
$post_exists = ( isset( $current_post ) && $current_post instanceof WP_Post );
if ( isset( $current_post ) && $current_post instanceof WP_Post) {}
array_push( $this->current_page, clone $current_post );
}
```
should be
```
function wpv_set_current_post( $current_post ) {
$post_exists = ( isset( $current_post ) && $current_post instanceof WP_Post );
if ( $post_exists ) {
array_push( $this->current_page, clone $current_post );
}
}
```
or something to that effect. the array push needs to be inside the conditional because $current_post is not an object somehow and that conditional is supposed to be checking that it's both an object and an instance of WP_Post
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Hi there
Thanks for reporting that, a clear flaw that can simply be fixed.
The developers are just finishing up a round of minor bug fixes, it should be possible to include the necessary change for this.
Feel free to edit the file in your own install directly, it will get overwritten with the official fix in the next update.