Hope this helps

Notice: Trying to get property of non-object in entity_extract_ids() (line 6439 of C:\xampp\htdocs\includes\common.inc).
Notice: Undefined index: field_name in _field_invoke() (line 198 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_name in _field_invoke() (line 198 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_name in _field_invoke() (line 198 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_name in _field_invoke() (line 198 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Trying to get property of non-object in entity_extract_ids() (line 6439 of C:\xampp\htdocs\includes\common.inc).
Notice: Undefined index: field_id in field_attach_delete() (line 995 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_id in field_attach_delete() (line 995 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_id in field_attach_delete() (line 995 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: field_id in field_attach_delete() (line 995 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Undefined index: module in field_attach_delete() (line 1003 of C:\xampp\htdocs\modules\field\field.attach.inc).
Notice: Trying to get property of non-object in path_taxonomy_term_delete() (line 307 of C:\xampp\htdocs\modules\path\path.module).
Notice: Trying to get property of non-object in taxonomy_taxonomy_term_delete() (line 1543 of C:\xampp\htdocs\modules\taxonomy\taxonomy.module).

Comments

klausi’s picture

Version: 7.0-alpha5 » 7.x-dev
Status: Active » Needs review
StatusFileSize
new1022 bytes

That's because taxonomy_vocabulary_delete() deletes single terms in a loop and if a term is a parent its children get deleted in the same call. Then a delete may be issued more than once for a term which causes confusion. This patch fixes taxonomy_term_delete().

fago’s picture

Issue tags: +Needs tests

Patch looks good to me. Imo this could need a test that makes sure this doesn't break again.

sp_key’s picture

Many thanks for your response and for fixing this.
Unfortunately I can't test because I don't know hot to run the patch (failed in previous attempts) but I'm more than happy to wait for next release.

craigmc’s picture

Applied patch locally. Deleted term with child terms successfully.

Works fine locally. Looks like a go to me. Tested taxonomy_delete_term with child items, and taxonomy_delete_vocabulary with multi-level vocabularies.

klausi’s picture

StatusFileSize
new1.75 KB

Hm, my analysis from #1 is a bit wrong, as taxonomy_vocabulary_delete() works as expected. The problem is taxonomy_term_delete(), where invalid term IDs are not checked. I ran into this when deleting all terms from a vocabulary in a loop, where I wanted to keep the vocabulary with its fields.

Now with a test. Not sure what I should use as invalid term ID. 42 seems a nice number though :-)

klausi’s picture

Title: Error deleting a taxonomy vocabulary » Error deleting an invalid term
klausi’s picture

Issue tags: -Needs tests

#5: 841798-term-delete.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests

The last submitted patch, 841798-term-delete.patch, failed testing.

klausi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.83 KB

reroll.

sp_key’s picture

Isn't 42 the answer to life the universe and everything?

ramlev’s picture

Assigned: Unassigned » ramlev
Status: Needs review » Reviewed & tested by the community

I have tested it on my local environment, the code looks fine to me, and the test was all ok.

dries’s picture

Status: Reviewed & tested by the community » Fixed

One could argue we should throw an exception but taxonomy module does not throw any exceptions so this actually looks pretty consistent.

Committed to CVS HEAD.

Status: Fixed » Closed (fixed)
Issue tags: -Needs tests

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