I was trying to re-view a patch that dealt with the forums earlier and came across this bug.

Steps to reproduce this error.

1. Enable forum module
2. Create a new forum
3. Create a new container
4. Using the drag & drop interface at admin/build/forum nest the forum underneath the container and click save.

Result.

Notice: Undefined variable: parent in taxonomy_term_save() (line 399 of /Users/joe/Sites/drupal_dev/d7head_testing/modules/taxonomy/taxonomy.module).

PDOException: INSERT INTO {taxonomy_term_hierarchy} (tid, parent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1) - Array ( [:db_insert_placeholder_0] => 54 [:db_insert_placeholder_1] => ) SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'parent' cannot be null in taxonomy_term_save() (line 401 of /Users/joe/Sites/drupal_dev/d7head_testing/modules/taxonomy/taxonomy.module).

The forum in question totally disappears afterwards as well. Yikes. Looks like #302412: DB TNG: Taxonomy.module is the culprit for reference, makes me think that we should really have tests for this functionality.

Attached patch fixes the issue, but does not include any tests.

Comments

Bojhan’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch failed testing.

eojthebrave’s picture

Reroll, still needs tests but I still haven't had a chance to fully wrap my head around it.

emmajane’s picture

This is still a problem as of August 4. It doesn't just give an error, it seems to have completely eaten a forum (container still visible).

To replicate:

1. Create Forum.
2. Create container.
3. Reorder so that Container is parent, forum is nested.
4. Save.
5. Blank screen (not enough PHP?)
6. Refresh browser window.
7. Error appears, forum now missing (container present):
* Warning: include(/home/emmajane/websites/drupal/drupal7/HEAD/includes/maintenance-page.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1145 of /home/emmajane/websites/drupal/drupal7/HEAD/includes/theme.inc).
* Warning: include(): Failed opening '/home/emmajane/websites/drupal/drupal7/HEAD/includes/maintenance-page.tpl.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in theme_render_template() (line 1145 of /home/emmajane/websites/drupal/drupal7/HEAD/includes/theme.inc).
8. Refresh again, error disappears, container present but forum is still missing.

emmajane’s picture

And more:

the forum I created is still present, but not showing up:

mysql> select * from taxonomy_term_data;
+-----+-----+----------+-------------------------------------+--------+
| tid | vid | name | description | weight |
+-----+-----+----------+-------------------------------------+--------+
| 1 | 2 | Cars | things that go on wheels with power | 0 |
| 2 | 2 | Vehicles | | 0 |
| 3 | 2 | Cars | | 0 |
+-----+-----+----------+-------------------------------------+--------+
3 rows in set (0.00 sec)

Vehicle is the container
Cars is the forum that keeps going missing when I reorder things.

alonpeer’s picture

This bug repeats for general Taxonomy terms re-ordering, not just forum.

emmajane’s picture

Title: Forum drag & drop broken, needs tests » Taxonomy drag & drop broken, needs tests
Component: forum.module » taxonomy.module

Updating the issue title and component per comment #6.

Bojhan’s picture

Status: Needs work » Fixed

I just tried to replicate this bug, and it seems fixed.

Status: Fixed » Closed (fixed)

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