Error retrieving node with media field
| Project: | Media Field |
| Version: | 5.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
I created a custom content type with the video field and a plain text field.
I uploaded a .wmv video and posted it to an organic group. It seemed to be working ok -- I was able to download the video and it played. Then I went back to view the node again and it got the following error.
Fatal error: Call to undefined function _field_file_load() in /var/www/html/th/thecreatornetwork.org/drupaltest/sites/all/modules/mediafield/videofield.module on line 331
The video is about 17MB.
I can still go to the file on the site and download it directly. Is there something I am doing wrong or is this a bug? Should I use the dev version instead, since it is more recent?
I have to admit this is my first Drupal site -- I've been studying it for a while but am still somewhat of a novice.
Thanks
Edwin Basye

#1
have fixed this problem. I am getting the same problem but mine when I submit the node.
#2
I am also getting this error when trying to view node. I used audio type and text field and when i try to view node I get this error:
Fatal error: Call to undefined function _field_file_load() in /var/www/html/staging/williams/modules/mediafield/audiofield.module on line 316
#3
I am getting the same error on a video (mpg) file
#4
Using the latest dev release I did some more testing. I added a video in a video mediafield and It seems to work under my windows environment where I have apachetriad2 running. I tried moving it to my web server and I get this:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/html/th/thecreatornetwork.org/drupaltest/sites/all/modules/mediafield/audiofield.module on line 433
This occurs on any node of the site I try to access.
I thought it might be the difference in PHP versions (5 on local Windows, 4 on web host server), so I switched it to 5 temporarily and got the same result. Maybe there is a missing or extra quote mark somewhere?
#5
looks like '$field' is misspelled as '$filed' under the '_field_file_load' function in both modules:
line 317 in audiofield.module:
/**
* Implementation of hook_field_formatter().
*/
function audiofield_field_formatter($field, $item, $formatter) {
if (!isset($item['fid'])) {
return '';
}
$file = _field_file_load($item['fid']);
return theme('audiofield', $file, $item, $filed);
}
line 332 in videofield.module:
/**
* Implementation of hook_field_formatter().
*/
function videofield_field_formatter($field, $item, $formatter) {
if (!isset($item['fid'])) {
return '';
}
$file = _field_file_load($item['fid']);
return theme('videofield', $file, $item, $filed);
}
Can anyone try this fix and confirm?
#6
I get the error as well with the video field on a node view. I dont think it is mis-spelled variables, its that the multimediafile.inc is not being parsed by php before videofield.module is, so then the undefined function error is presented.
#7
I think the suggestion that multimediafield.inc is not loaded in time is close - if I add
require_once('multimediafile.inc');
to the top of the audiofiield.module (1.0) file I can view the node.
In the dev version I see that:
require_once(drupal_get_path('module', 'audiofield') .'/multimediafile.inc'); is now at the top of the audiofield_field_formatter function, so this is probably the recommended fix.
Still, the mispelling in the them call might be a separate issue - $filed is not in scope, though both $file and $field are.
#8
xykon has made a patch that completely fixes the issue causing the error on line 331 message. Here's a link to his patch ...... text link for those needing to copy/paste http://drupal.org/files/issues/videomodule.patch
#9
patch seems to have worked for me - thx
#10
Patch could do with modding the audio module too... has it been submitted to the dev's yet?
#11
#12
To use the patch on the audiofield.module, just add the line
<?phprequire_once(drupal_get_path('module', 'audiofield) .'/multimediafile.inc);
?>
after line 312:
<?phpfunction audiofield_field_formatter($field, $item, $formatter) {
?>
Also make sure to fix the typo in line 318, it has
<?phpreturn theme('audiofield', $file, $item, $filed);
?>
and should be
<?phpreturn theme('audiofield', $file, $item, $field);
?>
The same goes for the videofield.module, just do a find and replace for $filed --> $field
Thanks, this seems to fix the bug.
#13
Now fixed in HEAD (http://drupal.org/cvs?commit=123606), new release on its way after other critical bugs are fixed.
#14
#15
Automatically closed -- issue fixed for two weeks with no activity.