Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Fatal error: Call to undefined function user_access() in modules/browscap/browscap.module on line 99
This error occurs from time to time and we cannot seem to pin it down.
Comment | File | Size | Author |
---|---|---|---|
#9 | move-access-to-init-1462344-9.patch | 2.57 KB | Devin Carlson |
#7 | move-access-to-init-1462344-7.patch | 2.14 KB | Devin Carlson |
Comments
Comment #1
venusrising CreditAttribution: venusrising commentedThis is printing in our feed and at the bottom of the page
Comment #2
venusrising CreditAttribution: venusrising commentedIf permission for admin are not selected to bypass it throws an error.
It also throws an error to the RSS feed for the homepage
Comment #3
rfayI have this as well. Drupal 6.24.
Comment #4
rfayWorkaround: Uncheck "Enable user agent log" in the settings.
Comment #5
Devin Carlson CreditAttribution: Devin Carlson commentedI think I finally managed to figure this out.
hook_exit()
runs at the end of each page request and runs even for cached page views. If the page is cached then Drupal may still be in bootstrap mode and certain modules may not yet be loaded (in the case of this error, user.module).I can think of a few ways to fix this, but I'm not sure which fix is best.
drupal_load()
to ensure that user.module is loaded when trying to check user permissions (good but I'm not sure how much additional load this create on each page request).module_exists('user')
and allow monitoring to be bypassed when user.module is loaded (on uncached pages) and record every user agent (even if they have bypass permissions) when they view cached content.If anyone has any suggestions, I'd very much appreciate them. In the mean time, the error can be bypassed by disabling user agent logging as rfay mentioned.
Comment #6
izmeez CreditAttribution: izmeez commentedSame issue with 6x-1.4 on login page, using logintoboggan. Revert to 1.3 no problem.
imho, with WSOD this is critical to using this update of the module.
Comment #7
Devin Carlson CreditAttribution: Devin Carlson commentedAfter giving this some more thought, I think that the best approach would be to attempt user agent recording both during init() and during exit(). That way, "processing" such as checking for user access, can occur during init() before recording the user agent on non-cached pages but recording would also happen during exit() to catch user agents visiting cached pages.
In order to prevent duplicate recordings, a static variable in a helper function could track if recording has already happened in init() and prevent another recording from happening during exit(). This will still prevent authenticated users from being accidentally recorded as an authenticated user will not get served a cached page.
The only "issue" with this implementation is that giving anonymous users the ability to bypass user agent monitoring will not work on cached pages, but, to my knowledge, there is no way around that and there isn't much point to not recording anonymous users.
Comment #8
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted to 7.x-1.x.
Comment #9
Devin Carlson CreditAttribution: Devin Carlson commentedBackport of #7.
Comment #10
Devin Carlson CreditAttribution: Devin Carlson commentedCommitted to 6.x-1.x.
Please test the latest git checkouts (or -dev releases after they are built) and to confirm that this issue is solved.
Comment #11
izmeez CreditAttribution: izmeez commentedI can confirm the new 6.x-1.x-dev update appears to work with no more WSOD.
Comment #13
gransar CreditAttribution: gransar commented@rfay there is no settings anymore... this error prevents dashboard from loading..
Comment #14
rfay@gransar you don't mention what version you're using. This should be resolved in all current versions.