views_cache_bully_view_is_exempt() tests the inited property of a view before calling the Views method uses_exposed(). Apparently blocks created by the Views modules on our test installation do not have the inited property set at all, but do have the uses_exposed() method defined. This way this module falsely sends error messages to watchdog.

My patch is the following: instead of testing the inited property, test the existence of the uses_exposed() method:

// old test: if (empty($view->inited)) {
if (empty($view->display[$view->current_display]->handler) || !method_exists($view->display[$view->current_display]->handler, 'uses_exposed')) {
  watchdog('views_cache_bully', 'Error, Views Cache Bully could not evaluate view exemption for view @view_name, view was not initialized.', array('@view_name' => $view->name));
}
CommentFileSizeAuthor
#6 views_cache_bully-check_uses_exposed.patch814 bytestenken
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lmeurs’s picture

Issue summary: View changes

Added remark about errors being falsely sent to watchdog.

dstol’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

I tried for a while to reproduce this, but failed. It'd be helpful if you could spin up a vanilla drupal install and provide a database dump or maybe just a view export that illustrates this issue.

lmeurs’s picture

Thank you for your reaction and time! Unfortunately I do not recall the site I was working on, so I cannot test the specific project. I did write down a note to myself that #2076273: Notice: undefined index view_name in views_cache_bully_view_is_exempt... might have been a duplicate, after the latest update of the module I did not reapply the changes I suggested in the original post. So far so good, but since error messages were being sent to watchdog possible errors can easily remain unnoticed for a while... Thanks again!

webservant316’s picture

oh yeah, just ran into this problem. My logs were filling up with this view cache bully warning...

'Error, Views Cache Bully could not evaluate view exemption for view @view_name, view was not initialized.'

The code snippet above worked for me.

The problem is easily reproduced. Just create a view block and attach the view block to a node.

webservant316’s picture

Status: Closed (cannot reproduce) » Active

As soon as some makes the fix into a patch we could head toward RTBC.

tenken’s picture

I am experiencing the same issue on a large website. The solution appears to work for me as well.

tenken’s picture

Attached patch that resolves issue for me from thread. Thanks lmeurs for the solution!

SaytO’s picture

Status: Active » Reviewed & tested by the community

This patch works for me, step to reviewed.
Although given that is not updated since 16 January 2014 I do not think that we we will see in a new version. hurts
But still remains hope step to tested by the community

  • dstol committed d35f96a on 7.x-3.x authored by tenken
    Issue #2116215 by tenken: Test for the existence of a method in...
dstol’s picture

Status: Reviewed & tested by the community » Fixed
dstol’s picture

Thanks for the patch!

lmeurs’s picture

Great news! But would have loved to be credited in the commit too... :-)

dstol’s picture

My bad! Still appreciate your effort!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.