drupal_get_path
JDSaward - August 7, 2009 - 03:22
| Project: | FileField Paths |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
function filefield_paths_init calls drupal_get_path.
With caching enabled that returns an error - 'Call to undefined function drupal_get_path()'.
Should the call be moved to hook_menu?

#1
I can confirm that this bug results in a White-Screen-of-Death for FileField Paths 5.x-1.3 under these conditions:
The specific PHP error message this function generates is:
PHP Fatal error: Call to undefined function drupal_get_path() in /var/www/vhosts/yourdomain.com/httpdocs/sites/all/modules/filefield_paths/filefield_paths.module on line 63
Any idea why
drupal_get_path()isn't working at this point? I even used Module Weight to try to delay loading this module to no luck.A temporary solution I created was to manually specify the path. So that function call is just replaced in the module with:
$_SERVER['DOCUMENT_ROOT'] . '/sites/all/modules/filefield_paths/modules/' . $module . '.inc'That'll have to do until someone can help come up with a patch.
#2
i can confirm this problem.
i had to roll the module back a version.
Greg
#3
Hi Guys,
Unfortunately (for you) I've been on holidays for the last week or so, so haven't had time to look into this yet.
Will look into it ASAP.
Cheers,
Deciphered.
#4
Hi Deciphered (and all),
Are there any new developments on this issue?
Thanks in advance
#5
I'm also getting this white page under the same conditions. I don't know how to view my PHP error, but when I view any page anonymously and reload that page, I get a blank screen. If I am logged in as Admin, I'm fine. I have to turn off the module to get my site to work again.
Should I be using noahterp's solution?
Dan
#6
Noahterp:
Could you help me a little bit with this? The code you are referring to is, I think, here:
/**
* Implementation of hook_init().
*/
function filefield_paths_init() {
foreach (module_list() as $module) {
if (file_exists($file = drupal_get_path('module', 'filefield_paths') .'/modules/'. $module .'.inc')) {
require_once $file;
}
}
}
And you are saying that a fix is to put this piece of code in there--but can you tell me where? Or just recode that block for me and paste it here in this note?
$_SERVER['DOCUMENT_ROOT'] . '/sites/all/modules/filefield_paths/modules/' . $module . '.inc'
Thanks in advance. I really appreciate any help you can give me.
Dan