Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
taxonomy.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Nov 2008 at 17:38 UTC
Updated:
27 Nov 2008 at 08:21 UTC
Jump to comment: Most recent file
Comments
Comment #1
cburschkaI posted #332054: Selecting <root> as parent causes PDOException already, but since you uploaded a patch, we'll continue here.
Comment #2
cburschkaStill, I wonder if it would just make sense to give "root" a key of 0 rather than '', since that avoids additional logic and 0 is not a valid tid either.
Comment #3
catchArancaytar, that makes sense. Although there's already some logic in taxonomy_term_save() which relies on the empty string, and it looks like that might get passed onto taxonomy_check_vocabulary_hierarchy() too. With a bit of luck, using '0' we'd be able to strip some of that logic out though.
Comment #4
cburschkaI don't see any relevant code in taxonomy_term_save except for this:
empty() returns TRUE for both '' and 0, so that is no problem. taxonomy_check_vocabulary_hierarchy also checks only the count() of this value, which is the same for '' and 0. I'll still test it just to be sure...
Edit: This fixes the problem for me.
Comment #5
catchSorry, I mis-typed, meant in taxonomy_form_term_submit (after taxonomy_term_save() is called):
Comment #6
cburschkaOh, in that case the key in the condition needs to be changed as well.
Comment #7
catchMuch better, added the test back in with this one.
Comment #8
webchickWill look at this a bit later. Tagging as a blocker for now.
Comment #9
webchickOk, great. Code looks good (much better), and tests continue to pass. Committed. Thanks! :)