Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | updated_form_check-1355968-2.patch | 1.31 KB | joostpluijmers |
fix.patch | 4.3 KB | joostpluijmers |
Comments
Comment #1
joostpluijmers CreditAttribution: joostpluijmers commentedI also forgot to mention, that I also altered the update case, so that when it is actualy empty it runs _taxonomy_title_delete.
Comment #2
jenlamptonThanks 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)
Comment #3
jenlamptonHm. Looks like this is a duplicate of #1205016: Duplicate entry error when title is empty please post new patches over there :)
Comment #4
joostpluijmers CreditAttribution: joostpluijmers commentedAh 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.
Comment #5
joostpluijmers CreditAttribution: joostpluijmers commentedDarn, forgot to reload this page. Moving my comment to there.
Comment #6
jenlamptonre-closing the issue :)