When attempting to load and save a taxonomy term programmatically, I was receiving the following SQL error:

Incorrect integer value: '' for column 'created' at row

I was able to reproduce this with the following code:

$term = taxonomy_term_load($tid);
taxonomy_term_save($term);

After some further investigation, I was able to track down the cause of the issue to line 194 of term_authoring_info.module:

$term->created = !empty($term->created) ? strtotime($term->created) : REQUEST_TIME;

I gather that the strtotime() function is called because the created time needs to be converted to a timestamp when submitting the taxonomy term edit form. I was able to fix the problem by adding a new submit handler to the term form in term_authoring_info_form_taxonomy_form_term_alter() and calling strtotime() in the submit handler instead.

A patch is attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Scott Robertson’s picture

Issue summary: View changes
DrupalChimp’s picture

Status: Needs review » Reviewed & tested by the community

I have tested this patch and it works as intended. Is this module still active? The maintainer has not reviewed this patch or commented for a year.

  • pijus committed 479c2c2 on 7.x-1.x
    Issue #2369953 by Scott Robertson: Error When Saving a Taxonomy Term...
pijus’s picture

Assigned: Unassigned » pijus
Scott Robertson’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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