Closed (won't fix)
Project:
File (Field) Paths
Version:
5.x-1.3
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Aug 2009 at 03:22 UTC
Updated:
22 Sep 2010 at 10:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
noahterp commentedI 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.
Comment #2
tomhung commentedi can confirm this problem.
i had to roll the module back a version.
Greg
Comment #3
decipheredHi 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.
Comment #4
asanvicente1 commentedHi Deciphered (and all),
Are there any new developments on this issue?
Thanks in advance
Comment #5
royerd commentedI'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
Comment #6
royerd commentedNoahterp:
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
Comment #7
noahterp commentedI replaced line 64 from:
if (file_exists($file = drupal_get_path('module', 'filefield_paths') .'/modules/'. $module .'.inc')) {to:
if (file_exists($file = $_SERVER['DOCUMENT_ROOT'] . '/sites/all/modules/filefield_paths/modules/' . $module . '.inc')) {So instead of calling
drupal_get_path(), I replaced it with a hard-coded version of what that function would have returned. You just have to make sure your module is installed in that exact path, otherwise you'll need to change that line to point to the right place.Comment #8
royerd commentedThanks much!
Comment #9
decipheredHi guys,
I had made the decision a while back that due to lack of time and personal use I would no longer be supporting Drupal 5.
I may consider committing the occasional patch if it is submitted correctly, and reviewed and tested by the community.
Cheers,
Deciphered.
Comment #10
jroth commentedThe following seems to work on my site.
Change this:
if (file_exists($file = drupal_get_path('module', 'filefield_paths') .'/modules/'. $module .'.inc')) {
to:
if (file_exists($file = dirname(drupal_get_filename('module', 'filefield_paths')) .'/modules/'. $module .'.inc')) {
Hopefully my patch works, this is my first one.
Comment #11
burlap commentedI was recently trying to investigate that too and I wonder, why is that in hook_init anyway? It seems, from the API documentation, that perhaps this should go to hook_menu instead? I didn't have time to test hook_menu yet, because I needed a quick and dirty solution, and I used the trick found in other modules to check whether the page is served from cache:
So far it works for me.
Comment #12
deciphered