Arancaytar found this bug on #251595: Add taxonomy_term_load_descendents(). Seems like the old db layer used to cast empty strings to 0/NULL on inserts, and db_insert() doesn't.
I've fixed this in the _submit() function and added a test.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | taxonomy_blank_0-332145-6.patch | 2.24 KB | catch |
| #6 | taxonomy_blank_0-332145-6.patch | 1.43 KB | cburschka |
| #4 | taxonomy_blank_0-332145-4.patch | 578 bytes | cburschka |
| empty_string.patch | 1.53 KB | catch |
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! :)