When I upload a flexinode with image fields and they're empty I get an error:

# warning: Attempt to assign property of non-object in C:\apachefriends\xampp\htdocs\searcy\modules\flexinode\field_image.inc on line 47.
# warning: Attempt to assign property of non-object in C:\apachefriends\xampp\htdocs\searcy\modules\flexinode\field_image.inc on line 48.

It looks like empty image fields aren't being handled and it's causing errors. It seems like a bug like this would have been fixed ages ago so I'm wondering if I've done something wrong. I've tried this in 4.7 and CVS.

Comments

mo6’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev
Status: Active » Needs review

Lines 47 and 48 in function flexinode_field_image_insert need to have a test, like:

  if (is_object($node->$fieldname)) {
    $node->$fieldname->smallpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_sm', $field->options[2]);
    $node->$fieldname->thumbpath = flexinode_field_image_make_smaller($node->$fieldname->filepath, '_th', $field->options[3]);
  }
mo6’s picture

The error occurs in php5, I've never seen it with php4.

serval-1’s picture

I ran into the same error. This solution made the warnings to disappear.

Thank you, George!

Bèr Kessels’s picture

Status: Needs review » Closed (duplicate)

dupe of http://drupal.org/node/71026

sidenote: don't set status to 'patch' if there is no patch attached. copy-pasting PHP code in the issue is not the same as a patch.