Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#11 | 762300-11.patch | 475 bytes | jpmckinney |
#11 | 762300-11.fix_.patch | 2.37 KB | jpmckinney |
#5 | 762300-4.patch | 1.9 KB | jpmckinney |
#3 | 759844-16.patch | 5.06 KB | jpmckinney |
Comments
Comment #1
涉水轻舟 CreditAttribution: 涉水轻舟 commentedI meet the same problem. How to fixed it……?
Comment #2
jpmckinney CreditAttribution: jpmckinney commentedI can confirm this bug, too.
Comment #3
jpmckinney CreditAttribution: jpmckinney commented$topic->num_comments should be $topic->comment_count
forum_get_topics() should collect the topic's type.
Comment #4
catchPatch is for drupal_path_prefix() ;)
Comment #5
jpmckinney CreditAttribution: jpmckinney commentedHahaha, oops.
Comment #6
jpmckinney CreditAttribution: jpmckinney commentedComment #7
aspilicious CreditAttribution: aspilicious commentedhmmm, I don't know much about the dbtng yet but don't we have to rewrite the query?
Comment #8
catchThe 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..
Comment #9
jpmckinney CreditAttribution: jpmckinney commentedSo, 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?
Comment #10
catchIf 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.
Comment #11
jpmckinney CreditAttribution: jpmckinney commentedTwo 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.
Comment #12
catchThanks for the test addition, looks great now.
Comment #13
Dries CreditAttribution: Dries commentedLooks good. Committed to CVS HEAD.
Comment #15
aro747 CreditAttribution: aro747 commentedI 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......
Comment #16
Neil Adair CreditAttribution: Neil Adair commentedFresh 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).