Download & Extend

Attempt to assign property of non-object in

Project:Upload previews
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

When I preview a post with uploaded images (by clicking on the Preview button while editing) I get the following warning:

warning: Attempt to assign property of non-object in .../upload_preview/upload_preview.module on line 150.

Comments

#1

Leo, I just stepped into the same warning.
Do you have any additional finding on that?
I am running D5.6 and UP 5.x-1.x-dev (2008-Jan-16)
Thank you.

#2

No, sorry. I stopped using the upload preview module because it caused a lot of problems for users. They told me it had to do with javascript, but since it isn't an essential feature of my website, I disabled the module.

#3

This module does not use any JavaScript whatsoever.

#4

I just had the same error.

You can reproduce it by previewing a node with image attachments

I made a quick fix to prevent the code executing in preview mode

upload_preview.module line 150

from this:


<?php
         
foreach ($node->content['files']['#files'] as $fid => $file) {
           
$node->content['files']['#files'][$fid]->preview = module_invoke_all('upload_preview', $file);
          }
?>

to this:

<?php
       
if($node->nid){
          foreach (
$node->content['files']['#files'] as $fid => $file) {
           
$node->content['files']['#files'][$fid]->preview = module_invoke_all('upload_preview', $file);
          }
        }
?>

hope that helps,

DT

#5

Status:active» needs review

Needs to review for inclusion into the module.

Thanks
Robert

#6

Status:needs review» fixed

Looks like a good simple patch included in CVS.

Thanks
Robert

#7

Title:upload preview preview» Attempt to assign property of non-object in

#8

Status:fixed» closed (fixed)

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