Replace line 291 in hits.class.php with the following:
if( is_object( $wp_query ) ) {
$this->current_page_id = $wp_query->get_queried_object_id();
}
Something else has unset the $wp_query object (which it shouldn’t do).
Closing due to inactivity.
Had the same messages and the fix seems to stopp them.
The above fix has already been committed for the next release so you shouldn’t have to make the change again.
I found some more warnings in my log, which let the file grow. Anything important?
[Fri Mar 06 14:18:18 2015] [warn] [client ] mod_fcgid: stderr: PHP Fatal error: Call to a member function get_queried_object_id() on a non-object in /pages/…/wp-content/plugins/wp-statistics/includes/classes/hits.class.php on line 382
[Fri Mar 06 15:09:11 2015] [warn] [client ] mod_fcgid: stderr: PHP Warning: require_once(./includes/functions/purge.php) [function.require-once]: failed to open stream: No such file or directory in /pages/…/wp-content/plugins/wp-statistics/schedule.php on line 121
The first one not an issue, I’ll add an check for the object.
The second one probably means your nightly purging isn’t happening, I’ll take a look at it.
Help me…
since the last update of woocommerce, my site is down…
with this error:
Fatal error: Call to a member function get_queried_object_id() on a non-object in /web/htdocs/mysite/home/wp-content/plugins/wp-statistics/includes/classes/hits.class.php on line 291
I tried to replace the line 291 as suggested , but I have a white screen
thank you
You can disable a plugin by renaming/deleting the folder in the wp-content directory.
I tried but it does not work , always a white screen
Are you still getting the “Fatal Error” above?
If so you haven’t removed the directory. Otherwise check for another error.
I have no more error , but I always a blank page
I’d suggest you start disabling other plugins until you find out which one is giving you problems. Probably start with WooCommerce if you haven’t already disabled it.