Forums

Undefined property: stdClass

diorist 16 Oct, 2008
I get the following "undefined property" errors on section pages with ChronoComments. The errors don't appear on article pages themselves, only on section layout pages---apparently regardless of whether those sections are (or aren't) selected in the Chronocomments parameters.

Unfortunately, changing the error settings in my php.ini doesn't seem to have an effect. Any other suggestions would be much appreciated. I'd love to use ChronoComments, and it does work beautifully on the article pages themselves; but, Oh!, those unsightly errors...

Notice: Undefined property: stdClass::$id in [site]/plugins/content/ChronoComments.php on line 96

Notice: Undefined property: stdClass::$sectionid in [site]/plugins/content/ChronoComments.php on line 120

Notice: Undefined property: stdClass::$id in [site]/plugins/content/ChronoComments.php on line 137

Notice: Trying to get property of non-object in [site]/plugins/content/ChronoComments.php on line 140

Notice: Trying to get property of non-object in [site]/plugins/content/ChronoComments.php on line 140

Notice: Trying to get property of non-object in [site]/plugins/content/ChronoComments.php on line 140


Setup is Joomla 1.5.7, CC 1.2, if that matters.

Thanks. - Diorist
diorist 23 Oct, 2008
Hi, Max.

I should've included more detail and used more precise terminology.😶

The errors appear on category pages (not sections). These category pages aren't generated by any specific component (except com_content)...erm, I think. One type is a category (article) list layout and the other is a category blog layout. There are actually a bunch of different category blog layout pages, but the errors are consistent across all of them.

The errors appear regardless of whether I've selected the affected sections, categories, or pages in the ChronoComments params. They also appear when nothing at all is selected in the params. In fact, when nothing is selected, I get a couple of additional errors.

I did try your patches, but of course they're specific to com_news and com_contact. I also tried adding com_content to line 17, but then the comments boxes didn't show up on article pages at all. (Obviously, that was pretty much a shot in the dark.)

Any suggestions?

Thanks! You're doing a great job.
Diorist
GreyHead 23 Oct, 2008
Hi diorist,

This is an untested hack but try putting these lines at the beginning of /plugins/content/ChronoComments.php
function plgContentChronocomments( &$row, &$params, $page=0 )
{
    // Insert this code
    if ( !property_exists($row->id) || !isset($row->id ) || $row->id == "" ) {
        return false;
    }
    // end insert


Bob
diorist 23 Oct, 2008
Thanks, Bob! I've was doing some mad googling before I came back here, though, and found a hint in another component's forum. Based on that, I just added variations of the following line before all of the lines identified by errors:

if(!isset($row->sectionid) )$row->sectionid = 0;


It seems to have worked, since the errors disappeared and the forms apparently function. But, tell me: will this modification have any bad or dangerous side effects?

Thanks again!
diorist
Max_admin 23 Oct, 2008
Hi diorist,

is this the only line of code you added ? show me all code lines, after you post some comment at any of these pages which had errors and refresh the page again, can you see your comment there ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
diorist 23 Oct, 2008
I actually added it three times. I think the line numbers were 97, 120, 121. I added each "fix" right before the line that was identified in the front-end error, changing only the variable to match the "problem" line. The exact three lines were:

if(!isset($row->sectionid) )$row->sectionid = 0;

if(!isset($row->id) )$row->id = 0;

if(!isset($row->catid) )$row->catid = 0;


I've attached the complete file for your review.

To Max's question, the errors were on category pages. The comment forms are only on article pages, so I never saw errors on commentable pages. In any case, the commenting function always worked great and seems to work still.

Hope this helps (and isn't terrible),
diorist
kbrookes 06 Dec, 2008
I'm having this problem as well, but unfortunately it wasn't totally fixed by the above poster's edits or the fix linked to on other pages.
GreyHead 07 Dec, 2008
Hi kbrookes,

Setting Error Reporting to None or System Default in your site Global Configuration will usually hide all these messages.

Bob
This topic is locked and no more replies can be posted.