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

dman’s picture

Status: Active » Fixed

Fair enough. I added something similar earlier in the loop instead to exit even quicker.

  foreach ($field_instances as $field_id => $field_def) {
    // Skip empty fields.
    if (empty($node->{$field_id})) {
      continue;
    }
finex’s picture

It looks correct, thanks :-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.