Closed (fixed)
Project:
File Ownage
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 May 2012 at 17:27 UTC
Updated:
26 May 2012 at 11:40 UTC
Hi, on the 7.x version it should be checked if a text field is empty before calling file_ownage_scan_embeds_process_text().
On file_ownage.module, function file_ownage_scan_embeds_process_node(), there is a foreach:
foreach ($node->{$field_id}['und'] as $delta => $field_content) {
$input = $field_content['value'];
$output = file_ownage_scan_embeds_process_text($input, $node, $settings);
if ($output === FALSE) {
// Failed to process
watchdog('image_ownage', "Trouble processing the field $field_id");
continue;
}
else {
if ($input != $output) {
$modified = TRUE;
$node->{$field_id}[$node->language][$delta]['value'] = $output;
}
}
}
this code should be executed only if $node->{$field_id}['und'] is not empty:
if (! empty($node->{$field_id}['und'])){
foreach ($node->{$field_id}['und'] as $delta => $field_content) {
$input = $field_content['value'];
$output = file_ownage_scan_embeds_process_text($input, $node, $settings);
if ($output === FALSE) {
// Failed to process
watchdog('image_ownage', "Trouble processing the field $field_id");
continue;
}
else {
if ($input != $output) {
$modified = TRUE;
$node->{$field_id}[$node->language][$delta]['value'] = $output;
}
}
}
}
Thanks.
Comments
Comment #1
dman commentedFair enough. I added something similar earlier in the loop instead to exit even quicker.
Comment #2
finex commentedIt looks correct, thanks :-)