When creating a new forum or forum container, I receive the following errors:

Notice: Undefined variable: forum_term in forum_forum_load() (line 757 of modules/forum/forum.module).
Notice: Trying to get property of non-object in forum_forum_load() (line 757 of /home/modules/forum/forum.module).
Notice: Undefined property: stdClass::$tid in forum_forum_load() (line 762 of /home/modules/forum/forum.module).

This discussion seems to have offered some idea as to where this error originates from:

http://drupal.org/node/1057712

Comments

Zgear’s picture

Version: 7.10 » 8.x-dev

drupal 8.x first, I reproduced a similar result by changing the taxonomy field to use the autocomplete widget instead of a list, then I created a forum and placed a comma into the field. The problem seems to lie with the variable $tid, although mine came up with $forum_tid. Perhaps we have a problem in how we are handling taxonomies in the forum module?

Zgear’s picture

credit goes to zendoodles for thinking of this way to reproduce
STR

  1. Install a drupal environment
  2. Navigate to modules page and make sure both taxonomies and forums are enabled.
  3. Navigate to structure>Content types then go through the edit link for forum topic
  4. Navigate to manage fields click on the select list link for the forums field
  5. Select the "Autocomplete term widget (tagging)" option in the drop down menu under widget type
  6. Navigate to the Content page and go through the add content link
  7. Select Forum topic, then put a comma into the textbox under forums
  8. Put any kind of text you want into the other textboxes and click save when done

you should come up with something like this

Warning: reset() expects parameter 1 to be array, null given in forum_node_presave() (line 328 of Sites/drupal/modules/forum/forum.module).
Warning: key() expects parameter 1 to be array, null given in forum_node_presave() (line 329 of Sites/drupal/modules/forum/forum.module).
Warning: Invalid argument supplied for foreach() in forum_field_storage_pre_insert() (line 525 of Sites/drupal/modules/forum/forum.module).
Notice: Undefined property: stdClass::$forum_tid in forum_node_view() (line 271 of Sites/drupal/modules/forum/forum.module).
Notice: Undefined property: stdClass::$forum_tid in forum_node_view() (line 271 of Sites/drupal/modules/forum/forum.module).
berdir’s picture

Issue tags: +Needs tests
cweagans’s picture

Issue tags: +Needs backport to D7
tillsanders’s picture

Title: Core Forum Undefined Variable, Undefined Property » Maybe I got a solution
Version: 8.x-dev » 7.15

Tried that one? Worked for me:

http://drupal.org/node/1057712#comment-4733236

cweagans’s picture

Title: Maybe I got a solution » Core Forum Undefined Variable, Undefined Property
Version: 7.15 » 8.x-dev

Please don't change the issue metadata.

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.

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.

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.

thursday_bw’s picture

Issue summary: View changes

Give this change record https://www.drupal.org/node/2079767 where the function in question on this error doesn't exist in drupal 8 anymore.
Can we re-action the change of the version on this issue, marking it as drupal 7.

I understand there is a reference to this being replicated in drupal 8 but that was prior to this change record.

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.

quietone’s picture

Version: 8.9.x-dev » 7.x-dev
Issue summary: View changes
StatusFileSize
new24.4 KB

I tested this on Drupal 9.3.x, standard install, using the steps in #2, and was not able to reproduce the problem. On saving the forum topic I received, "the value should not be null".

Since this is tagged for backport and I have not tested with Drupal, changing version.

poker10’s picture

It seems like there are two different problems mentioned in this issue.

The first one is when you try to pass empty string TID to the forum_forum_load() function. This will cause notices and warnings mentioned in issue summary. See: https://www.drupal.org/node/1057712

The second problem is mentioned in #2 - these steps are not steps to reproduce the original problem, but the separate issue, when you try to save forum topic with forum reference value set to comma. This will not trigger the notices mentioned in issue summary, but different notices.

I think this issue should focus on fixing the problem mentioned in the issue summary and potentially the next issue should be created to fix the problem with saving forum topic with forum reference set to comma - which will (on PHP 8.1) throw a TypeError:

TypeError: reset(): Argument #1 ($array) must be of type array, null given in reset() (line 334 of /modules/forum/forum.module).

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.