Skip Navigation

[Resolved] logic Error

This support ticket is created 2 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 2 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#2407799

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

#2407855

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.