Attempt to assign property of non-object in

leop - September 28, 2007 - 12:46
Project:Upload previews
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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.

#1

skizzo - January 23, 2008 - 16:00

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

leop - January 24, 2008 - 11:36

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

kkaefer - March 23, 2008 - 17:36

This module does not use any JavaScript whatsoever.

#4

davidwhthomas - October 1, 2008 - 22:41

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

rmiddle - October 9, 2008 - 04:25
Status:active» needs review

Needs to review for inclusion into the module.

Thanks
Robert

#6

rmiddle - December 6, 2008 - 03:09
Status:needs review» fixed

Looks like a good simple patch included in CVS.

Thanks
Robert

#7

rmiddle - December 6, 2008 - 03:10
Title:upload preview preview» Attempt to assign property of non-object in

#8

System Message - December 20, 2008 - 03:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.