When moving a forum topic to a different forum, leaving behind a shadow copy, the forum where the shadow copy resides gives the following error:

Notice: Undefined property: stdClass::$new_replies in template_preprocess_forum_topic_list() (line 1115 of C:\wamp\www\drupal\modules\forum\forum.module).

I tried this on a nearly clean drupal 7 installation(2011-Jan-05 production version) on on a localhost WAMP stack

Comments

droplet’s picture

Version: 7.0 » 8.x-dev
Priority: Major » Normal
Status: Active » Needs review
Issue tags: -Forum +Needs backport to D7
StatusFileSize
new723 bytes
droplet’s picture

#1: forum.patch queued for re-testing.

droplet’s picture

Issue tags: +Quick fix
dnewkerk’s picture

Tested and confirm it worked on Drupal 7.8. How can I help get this into the next D7 release? I've never tried installing D8 yet, but if that would help let me know.

Anonymous’s picture

@Keyz, yes, please test it on D8 and report back here. I've looked at the code and it's a simple fix that makes sense, so if it works for you on D8, mark this issue as RTBC. Thanks!

dnewkerk’s picture

Status: Needs review » Reviewed & tested by the community

Tested in Drupal 8.x-dev and works perfectly. As mentioned, it also works perfect in Drupal 7.8.

chx’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

How could this slip through testing? Does this mean the forum moving is not tested?

droplet’s picture

Status: Needs work » Needs review
StatusFileSize
new1.19 KB

want to see testbot comment :)

droplet’s picture

StatusFileSize
new1.19 KB
droplet’s picture

Status: Needs review » Needs work
Issue tags: -Quick fix

will add a test later.

yurtboy’s picture

not sure if this helps, I was testing the patch at http://drupal.org/node/1578998#comment-6110650 and then got the above error.
I applied cleanly the patch in #9 above and the error was gone.

chx’s picture

droplet, thanks for working on this.

laufeyjarson’s picture

Has this been applied to version 7.x? I see comment #6 says it works, but I also see "needs backport" and am getting the error in 7.16.

Anonymous’s picture

Applied the above patch by hand on 7.19 and that fixed it. This bug is also referenced at #1578998: move forum topic and leave shadow cause duplicated topics show in list at #9.

csc4’s picture

Still doesn't seem to have been committed?

nchase’s picture

Issue summary: View changes

in 7.32 error is still there:

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

The real problem is that the shadow copy sits in the same forum as the moved topic where the old forum shows the same: The moved topic and the shadow copy.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: 1123866-move-topic-err.patch, failed testing.

gemalm’s picture

Same here, getting the error in 7.32. But applying manually the last submitted patch commented in #9 it works fine!

Thanks.

gemalm’s picture

StatusFileSize
new1.24 KB

Hei,
I have generated the patch for the current branch 7.x

rteijeiro’s picture

+++ b/modules/forum/forum.module
@@ -980,18 +980,12 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
+  // folder is new if topic is new or there are new comments since last visit

Could you start the comment with capitals and end with a period, please? I know that was wrong in original patch but we should try to follow coding standards.

Remember to change issue status to "Needs review" in order to let testbot start to test it.

Thanks for the re-roll :)

gemalm’s picture

Status: Needs work » Needs review
StatusFileSize
new1.24 KB

Thanks Ruben :)
I have modified the patch and changed the status to "Needs review".

rteijeiro’s picture

+++ b/modules/forum/forum.module
@@ -980,18 +980,12 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
+  // Folder is new if topic is new or there are new comments since last visit.

Good! Now it looks like you should fix indentation of the comment to same level than 'if' statement.

gemalm’s picture

StatusFileSize
new1.24 KB

Thanks for your tips rteijeiro
Indentation added to the comment.

The last submitted patch, 22: D7-forum_topic_err-1123866-22-do-no-test.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 24: D7-forum_topic_err-1123866-24-do-no-test.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 24: D7-forum_topic_err-1123866-24-do-no-test.patch, failed testing.

rteijeiro’s picture

It looks like the path where you created the patch is not correct. Try to create the patch from drupal root.

salvis’s picture

If it's a D7 patch then it probably won't apply to D8, that's why it makes sense to name it "do-not-test", except there's a "t" missing.

droplet’s picture

David_Rothstein’s picture

Title: error when moving a forum topic. » PHP notice when moving a forum topic and leaving behind a shadow copy
Version: 7.x-dev » 8.0.x-dev
Status: Needs review » Needs work
Issue tags: +Needs backport to D7

There may be a more serious bug in Drupal 8 also (that is masking this one), but the code that leads to the PHP notice looks the same in Drupal 8 (ForumManager::getTopics()).... It needs the same change to make sure $topic->new_replies always gets set, doesn't it?

lokapujya’s picture

StatusFileSize
new1.38 KB
+++ b/core/modules/forum/forum.module
@@ -954,16 +954,11 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
+    if ($user->uid || $topic->forum_tid == $tid) {

Won't the forum_tid always be the same as the $tid since it is filtered in the query?

The original problem doesn't seem to exist anymore in D8. Rerolled, and removed the $tid check.

lokapujya’s picture

Status: Needs work » Needs review
salvis’s picture

Status: Needs review » Needs work

This issue is not held up because #9 did not work but because we don't have tests.

I don't think any of the patches after #9 are correct.

lokapujya’s picture

#34 is a reroll of 9, plus the change described in #34. We ARE adding a test here: #2390065 Does that test cover this issue also?

jcchapster’s picture

Verified that the patch for D7 in comment 36 worked for me using Drupal 7.38. I am able to move a thread, leaving a shadow. Viewing the moved thread, and/or clicking on "This topic has been moved" both result in viewing the thread without the error.

mgifford’s picture

StatusFileSize
new1.38 KB

Re-uploading patch for the bots.

mgifford’s picture

Status: Needs work » Needs review

Still needs work as per #36

lokapujya’s picture

Status: Needs review » Postponed

I think we can use the test from https://www.drupal.org/node/2390065?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

fuzzy76’s picture

Keeping bugs in in production, holding up a thoroughly tested D7 patch for five years while waiting for D8 tests. This is just wrong.

droplet’s picture

Status: Postponed » Needs work

As what I can remembered #31, it's the different story in D8. the tests can be alone or merged soon. let's review the current issue or add a test and then move forward.

Join the party and tell something we never noticed before, we can do it better: #2706483: [policy, no patch] Policy to help less interested Patch move forward.

lokapujya’s picture

It was 7 months ago, so I don't remember, but It looks like I postponed the issue on #2390065 because I think it has the TEST that is needed for this issue to move forward.

fuzzy76’s picture

@droplet But this was about the D7 patch which was thoroughly tested, so this is more about the backport and/or test policy and not lack of interest. Keeping bugs in the codebase because of test coverage.

lokapujya’s picture

Someone could just copy the test from https://www.drupal.org/node/2390065 and add it to the patch for this issue and we would be done.

lokapujya’s picture

Not writing a test is the same as lack of interest.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

charlieji’s picture

I have just commented out the 'Leave shadow copy' function in the core module. The issue I had was exactly same as #16.

I am using the 7.59 core module. It seems like the latest drupal 7 core module is still having this issue?

I understand it is not right thing to do to change the core. Can we disable or let user to have the option to disable the 'Leave shadow copy' check box in the next release?

fuzzy76’s picture

Or we could use the 7 year old, tested patch...

Unless you believe that commiting code without tests would do more harm to the code base than leaving bugs unpatched for 7 years...

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

Forum is approved for removal. See #1898812: [policy] Deprecate forum module for removal in Drupal 11

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to the contributed extension once the Drupal 11 branch is open.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Project: Drupal core » Forum
Version: 11.x-dev » 1.0.1
Component: forum.module » Code
Status: Postponed » Needs work