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.
Comment | File | Size | Author |
---|---|---|---|
#3 | maca-elearning_test_users_peter-epp.png | 154.75 KB | teknocat |
#2 | incorrect-call-to-views_access_callback_access_callback-2807687.patch | 738 bytes | teknocat |
Comments
Comment #2
teknocat CreditAttribution: teknocat commentedAnd here is the patch.
Comment #3
teknocat CreditAttribution: teknocat commentedFor 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().
Comment #4
pingwin4eg@teknocat this is already fixed in dev branch - #2126835: Fatal error for users without the "access all views" permission in a page with a Views block