There is a check in hook_taxonomy that checks if isset($array['taxonomy_title']).

The values passed to hook_taxonomy are from the form API (more concrete the form_state variable). Where all fields are always set, but just empty.

I replaced the checks with: !empty($array['taxonomy_title'])

This is my first patch. Let me know if it works.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joostpluijmers’s picture

I also forgot to mention, that I also altered the update case, so that when it is actualy empty it runs _taxonomy_title_delete.

jenlampton’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Needs review » Needs work

Thanks for the patch :) You might want to check out http://drupal.org/node/707484 on how to create patches, but please keep them coming :)

Can you please cut/paste the error you are getting into a comment, or better yet, into the original issue? people who are getting the same error would probably like to be able to google for it :)

A few comments on the patch:
- there are lines in your patch file that remove and then add the same line back. I'm not sure why it's doing this (and it's not a big deal) but could be avoided.
- We probably don't want to be running a delete query if a term never had a title in the first place. Can you see if you can find a way to compare current value to previous? (preferably that doesn't involve an extra query)

jenlampton’s picture

Status: Needs work » Closed (duplicate)

Hm. Looks like this is a duplicate of #1205016: Duplicate entry error when title is empty please post new patches over there :)

joostpluijmers’s picture

Status: Closed (duplicate) » Needs work
FileSize
1.31 KB

Ah yea, those lines are probably the result of my overachieving IDE. The produced was:

user warning: Duplicate entry '2' for key 'PRIMARY' query: INSERT INTO taxonomy_title (tid, title) VALUES (2, '') in taxonomy_title.module on line 161.

This error occurred in the event that you edit a term with an empty title. The empty titles were caused by checking if a $form_state value was set, which it always is due to the form API. The update function checks against existence of a record which exists with an empty title string, but the check fails because an empty string is also false (go PHP freetyping ;). Thus causing the insert error.

I uploaded a new patch, with only the necessary lines. It also includes a ‘no query’ check by submitting an arbitrary flag that signals if there was a previous taxonomy title.

joostpluijmers’s picture

Darn, forgot to reload this page. Moving my comment to there.

jenlampton’s picture

Status: Needs work » Closed (duplicate)

re-closing the issue :)