Jump to content


Photo

Warning: Creating Default Object From Empty Value


  • Please log in to reply
10 replies to this topic

#1 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 30 November 2012 - 10:25 AM

Hi all,

I have a website that is now showing an error message I have no clue about. I think I know the cause to be changing my web hosting php version from 5.2 to 5.4. I have now changed this back but i'm still getting the error:

Warning: Creating default object from empty value in /homepages/32/d291630191/htdocs/RCON/modules/mod_fpss/mod_fpss.php on line 143

I have attached the file it refers to, the website to see the error is www.renovoconstruction.co.uk

If anyone could help it would be greatly appreciated

Many Thanks,

David

<snip removed attached file>

Edited by PFMaBiSmAd, 04 December 2012 - 08:20 AM.


#2 SocialCloud

SocialCloud

    Advanced Member

  • Members
  • PipPipPip
  • 613 posts

Posted 30 November 2012 - 10:33 AM

It's doubtful that anyone will download a file attachment. Please post the code on here instead.

#3 silkfire

silkfire

    Advanced Member

  • Members
  • PipPipPip
  • 572 posts
  • LocationStockholm, Sweden

Posted 30 November 2012 - 10:55 AM

You get this error because you're trying to assign properties to an object that hasn't been declared previously. Your best way to solve it is to create an empty object (stdClass) and then put as the value of its respective key.

$slide_object = new stdClass;

// Slide name
if ($row->itemlink && $row->title)
$slide_object->name = $row->title; //$row->name
elseif ($row->menulink && $menuItem)
$slide_object->name = $menuItem->name; //$row->name
else
$slide_object->name = $row->name;

if (!$showName)
$slide_object->name = '';


$output[$key] = $slide_object;


#4 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 30 November 2012 - 11:05 AM

You get this error because you're trying to assign properties to an object that hasn't been declared previously. Your best way to solve it is to create an empty object (stdClass) and then put as the value of its respective key.

$slide_object = new stdClass;

// Slide name
if ($row->itemlink && $row->title)
$slide_object->name = $row->title; //$row->name
elseif ($row->menulink && $menuItem)
$slide_object->name = $menuItem->name; //$row->name
else
$slide_object->name = $row->name;

if (!$showName)
$slide_object->name = '';


$output[$key] = $slide_object;


Sorry Silk but I have no idea what you have suggested or how I do it. Is the code you have posted what I need to add to the php file? If so where does it need to go?

Many Thanks
David

#5 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 30 November 2012 - 03:52 PM

Sorry for the double post but I've copied and pasted the code silk gave me and I've now got the same error but on a new line in the file. Line 159

I just don't know enough about PHP to fix this if it's a multiple thing so any additional help would be great.

Many Thanks
David

#6 trq

trq

    Advanced Member

  • Administrators
  • 30,904 posts
  • LocationSydney, Australia.

Posted 30 November 2012 - 04:04 PM

Again, post some relevant code.

http://thorpesystems.com | http://proemframework.org | http://github.com/trq

SmtpCatcher - A very simple mock sendmail useful for testing PHP mail scripts.
OPM - My Linux package manager.


#7 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 30 November 2012 - 06:13 PM

<snip removed copyrighted code>

Edited by PFMaBiSmAd, 04 December 2012 - 08:19 AM.


#8 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 04 December 2012 - 07:01 AM

Can anyone help on this?

The first error was on line 143 and since I copied and pasted the code silkfire gave it now says error on line 159. I have no idea whether this is the same error and its moved from the code I put in or a new error?

Many Thanks
David

#9 SocialCloud

SocialCloud

    Advanced Member

  • Members
  • PipPipPip
  • 613 posts

Posted 04 December 2012 - 07:06 AM

As much as I'd love to go counting lines? Which lines are 143 and 159?

#10 dgowrie

dgowrie

    Newbie

  • New Members
  • Pip
  • 6 posts

Posted 04 December 2012 - 07:22 AM

Haha, sorry social. Lines 142 to 160 are below:


// Compare display options between component and module
$showName = ($fpssSlideTitle=='') ? $row->showtitle : $fpssSlideTitle;
$showSectionTitle = ($fpssSlideSec=='') ? $row->showseccat : $fpssSlideSec;
$showCategoryTitle = ($fpssSlideCat=='') ? $row->showseccat : $fpssSlideCat;
$showText = ($fpssSlideText=='') ? $row->showcustomtext : $fpssSlideText;
$showTagline = ($fpssSlideTagline=='') ? $row->showplaintext : $fpssSlideTagline;
$showReadMore = ($fpssSlideReadMore=='') ? $row->showreadmore : $fpssSlideReadMore;

// Get menu data
if($row->menulink) $menuItem = $menu->getItem($row->menulink);

// Slide name
if($row->itemlink && $row->title){
$output[$key]->name = $row->title; //$row->name
} elseif($row->menulink && $menuItem){
$output[$key]->name = $menuItem->name; //$row->name
} else {
$output[$key]->name = $row->name;
}

#11 PFMaBiSmAd

PFMaBiSmAd

    Advanced Member

  • Staff Alumni
  • 16,767 posts
  • LocationColorado, U.S.A.

Posted 04 December 2012 - 08:18 AM

You have a third party script that is either -

A) Missing some code (or it's not being seen as being code) that would have defined the missing objects, which means that you won't get it to actually work just by 'fixing' each of these current errors, because there is more missing than is what is causing these current errors, or

B) It is a poorly written script that always produced these errors, but they were being hidden by php's error_reporting/display_errors settings.

In fact, this is a purchased copyrighted script that you cannot post here (I have edited your posts to remove the complete code). You should contact the author for support.

Also, moving this thread to the third party script forum section.
Signature: (not a comment about anything you posted unless specifically indicated)
Debugging step #1: To get past the garbage-out equals garbage-in stage in your code, you must check that the inputs to your code are what you expect.

Programming is just problem solving, but it is done in another language. You must learn enough of the programming language you are using to be able to read and write code.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com