Jump to content

Warning: Creating Default Object From Empty Value


dgowrie

Recommended Posts

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
Link to comment
Share on other sites

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;

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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;

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.