Cached pages give "call to undefined function" error
David_Rothstein - February 25, 2008 - 20:25
| Project: | Visibility API |
| Version: | 5.x-1.2-1 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I'm using Visibility API with caching enabled (normal caching, not aggressive). I found that whenever you log out and visit a cached page, you get a white screen of death with this error message:
Fatal error: Call to undefined function drupal_add_js() in /web/sites/all/modules/visibility_api/visibility_api.module on line 13The problem is that in Drupal 5, drupal_add_js() should not be called in hook_init() since this function is not available on cached pages. See http://api.drupal.org/api/function/hook_init/5.
Here is a patch that fixes this by moving the code to hook_menu(), as suggested on that page. You may want to try a different solution instead, but this fixes the bug.
Thanks!
| Attachment | Size |
|---|---|
| visibility_api_hook_init.patch | 768 bytes |

#1
Sorry about that! I am aware of that issue but I have a nasty habit of adding js in init(); even today haha
#2
Automatically closed -- issue fixed for two weeks with no activity.