In the views_access_callback_plugin_access_callback class, the access() method makes a call to views_access_callback_access_callback, but it passes in the wrong arguments. This results in a PHP error about it missing the 3rd argument, but this is just a warning, it carries on anyway and the actual resulting error occurs when it's trying to load the view because the view name and display ID are not being passed in.

I only ran into the error when using a user role that wasn't godlike and had access to all views anyway. I'm not sure why I didn't run into this sooner, as it all seemed to be working fine, but clearly I must not have tested it with a user of the right role.

The fix is really simple, patch will be posted shortly.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

teknocat created an issue. See original summary.

teknocat’s picture

teknocat’s picture

For further clarity, the actual error that results from this bug is as follows:

Fatal error: Call to a member function set_display() on a non-object in /[path-to-site]/sites/all/modules/contrib/views_access_callback/views_access_callback.module on line 23

Attached is a screenshot showing the full backtrace. If you review the watchdog log, you can see the PHP warnings leading up to this error:

Notice: Undefined index: views_access_callbacks in views_access_callback_plugin_access_callback->access() (line 9 of /[path-to-site]/sites/all/modules/contrib/views_access_callback/views_access_callback_plugin_access_callback.inc).

This is from trying to reference $this->options['views_access_callbacks'] instead of $this->options['views_access_callback'].

Followed by:

Warning: Missing argument 3 for views_access_callback_access_callback(), called in /[path-to-site]/sites/all/modules/contrib/views_access_callback/views_access_callback_plugin_access_callback.inc on line 9 and defined in views_access_callback_access_callback() (line 19 of /[path-to-site]/sites/all/modules/contrib/views_access_callback/views_access_callback.module).

These two issues result in the function receiving incorrect first and second arguments, along with no third argument. As such, without a view name or display, the view cannot be loaded on line 22 of views_access_callback.module and therefore it's not an object on which you can call the method set_display().

Fatal error backtrace

pingwin4eg’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Closed (duplicate)