The code in taxonomy_term_save does not check to see if the parent variable is not null before it tries to insert data into taxonomy_term_hierarchy. We should check that the parent tid is not null first.
This bug is difficult to reproduce. It occurs SOMETIMES when saving a taxonomy term using the taxonomy_manager module. I chose a taxonomy term on the root level and clicked save. The following error appears. After closing the pop up, the term no longer appears in the taxonomy manager because its taxonomy_term_hierarchy record was deleted.
An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'parent' cannot be null: INSERT INTO {taxonomy_term_hierarchy} (tid, parent) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array
(
[:db_insert_placeholder_0] => 15152
[:db_insert_placeholder_1] =>
)
in taxonomy_term_save() (line 679 of .../modules/taxonomy/taxonomy.module)
Comment | File | Size | Author |
---|---|---|---|
#11 | core-2064395-prevent_null_parent_tids.patch | 1.34 KB | Anonymous (not verified) |
#9 | core-2064395-prevent_null_parent_tids.patch | 1.34 KB | Anonymous (not verified) |
#6 | core-2064395-prevent_null_parent_tids.patch | 1.37 KB | Anonymous (not verified) |
#4 | core-2064395-prevent_null_parent_tids.patch | 1.41 KB | Anonymous (not verified) |
#3 | 2064395-prevent_null_parent_tids.patch | 904 bytes | Anonymous (not verified) |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedUpdated patch
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedUpdated patch
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedBump. Can I get some eyes on this please?
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedBump. Can I get some eyes on this please?
Comment #14
kdborg@gmail.com CreditAttribution: kdborg@gmail.com as a volunteer commentedI had this issue with a migration using a default value of 0 for terms that didn't have a parent. It appears to work for that case.
Comment #15
iaminawe CreditAttribution: iaminawe commentedI am not sure why but this bug recently started happening to me with addressfield when trying to save a profile and this patch was the only thing that worked to remove the error and allow profiles to be saved. +1 for this being committed - works great for me. Thanks