Messages:

Notice: Undefined property: stdClass::$num_comments in template_preprocess_forum_topic_list() (line 1049 of E:\xampp\htdocs\d7dev\modules\forum\forum.module).
Notice: Undefined property: stdClass::$type in comment_new_page_count() (line 516 of E:\xampp\htdocs\d7dev\modules\comment\comment.module).
Notice: Undefined property: stdClass::$type in comment_new_page_count() (line 517 of E:\xampp\htdocs\d7dev\modules\comment\comment.module).

Steps:
1.One user create a topic on any forum.
2.One user add a new comment to the new topic the one user just created.
3.login with another user.
4.visit the forum that contain the new topic and Error message show up.

More detail:
OS: windows 7
webserver and PHP : Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
Drupal: drupal 7.dev 2010.04.05

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

涉水轻舟’s picture

I meet the same problem. How to fixed it……?

jpmckinney’s picture

I can confirm this bug, too.

jpmckinney’s picture

Status: Active » Needs review
FileSize
5.06 KB

$topic->num_comments should be $topic->comment_count

forum_get_topics() should collect the topic's type.

catch’s picture

Status: Needs review » Needs work

Patch is for drupal_path_prefix() ;)

jpmckinney’s picture

FileSize
1.9 KB

Hahaha, oops.

jpmckinney’s picture

Status: Needs work » Needs review
aspilicious’s picture

hmmm, I don't know much about the dbtng yet but don't we have to rewrite the query?

catch’s picture

The query which gets the $nids in the first place has a node_access tag, so that covers this subsequent one.

It'd be good to get the steps to reproduce from #1 into a test case though. There ought to be something in forum.test which covers steps 1-3, so adding step 4 is hopefully not too much work. Last time I looked forum.test was a real mess though..

jpmckinney’s picture

So, you want a test that checks if the page produces PHP notices? That seems a bit odd, as we can write an infinite number of tests that each perform a different permutation of actions, each checking to see if a PHP notice pops up. It would be more like "disfunctional testing". If, in a test, you visit a page that produces PHP notices, will DrupalWebTestCase complain by itself? Or do I need an assertion?

catch’s picture

If you visit the page, notices will be caught as exceptions by the test framework which counts as a fail - so once the conditions are in place, drupalGet('page/throwing/notices'); is plenty yeah. We can fill in the gaps later, but that at least ensures this chunk of code is getting run at all by the test framework.

jpmckinney’s picture

FileSize
2.37 KB
475 bytes

Two patches: one with test only, one with test and fix. Note that you'll see some E_STRICT warnings until #348448: Always report E_STRICT errors is committed.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the test addition, looks great now.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good. Committed to CVS HEAD.

Status: Fixed » Closed (fixed)

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

aro747’s picture

I just did a fresh install of 7.7 and just got this error in the forum: Notice: Undefined property: stdClass::$new_replies in template_preprocess_forum_topic_list() (line 1132 of......

Neil Adair’s picture

Priority: Critical » Normal

Fresh install of 7.8 with no modifications to forum same error

Notice: Undefined property: stdClass::$new_replies in template_preprocess_forum_topic_list() (line 1136 of .../modules/forum/forum.module).