The upload_image_save function handles each $node->files as an array instead of a StdClass. Attached patch should fix this issue.

CommentFileSizeAuthor
upload_image_file_class.patch635 bytesmoonray

Comments

drewish’s picture

it had been an object but i'd switched it to an array because that's what was coming in form the form. what operation were you performing when you ran into the error? and what was the error?

i'd be much more into committing the change if you explicitly cast $file to an object or an array...

moonray’s picture

I was using the category_outliner module to edit the title of the page.
The module loads the node into memory, then saves it.
As such, it never goes through a form...

I'm leaving on a 6 week vacation, so I doubt I'll have more time to work on this right now.
If I do, you'll see a patch appear in this issue before long. If not, feel free to modify the patch.

drupalninja99’s picture

here's the error i'm getting:

Fatal error: Cannot use object of type stdClass as array in /Users/jaycallicott/Sites/estatesalesdallas/modules/upload_image/upload_image.module on line 136

drupalninja99’s picture

here's a mini patch, line #136

if ($file->remove && ereg('^(image/)', $file->filemime)) {

drewish’s picture

Status: Needs review » Needs work

jaykali, did you read the comments i've already left on this issue? you need to explicitly cast it to an object or an array. because it seems to vary between installations.

killes@www.drop.org’s picture

Status: Needs work » Closed (won't fix)

this seems to be all working fine on php 5.2