Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I got this error when trying to edit a node from a content type for which node weight was not enabled. The problem was that $node->weight_weight was empty but not null and database field is constraint to accept integer values. I fixed by casting the weight value to int in the _weight_set_weight function. I'm sorry I didn't have time to submit a patch but this was just a temporary fix. I think the _weight_set_weight function shouldn't be called at all if weight hasn't been enabled for that content type.
Comments
Comment #1
davisbenThis was fixed in #1589932: Weight not saving default value.
Comment #2
davisbenActually, it looks like this was still persisting. Fixed now.
Comment #3
marty.true CreditAttribution: marty.true commentedWhen you say "Fixed now", where is this "fixed"? I am still getting this error and the 7.x-2.0 is dated 5-19-12 and the dev version is dated 5-21-12. So how/where was this "fixed" today?
Comment #4
davisbenThe dev releases are packaged every 12 or so hours, so you'll need to wait until the packaging scripts next runs, or you can get the most recent code from git now.
Comment #5
marty.true CreditAttribution: marty.true commentedOkay, thanks for the quick reply :)
Comment #7
damien_vancouver CreditAttribution: damien_vancouver commentedI encountered this error upgrading to 7.x-2.0 and was unable to find this issue right away... so I've updated the issue to include a bit more of the error message.
For me the full error message looked like:
and occurs whenever inserting a new node, or updating a node that did not already have a numeric weight.
Updating to 7.x-2.x-dev fixed the problem for me thanks to http://drupalcode.org/project/weight.git/commit/9c1969cd73da05efc4a1603f...
Comment #8
BD3 CreditAttribution: BD3 commentedI can confirm that this is happening in 7.x-2.0 as well as #7 mentioned. Upgrading to 7.x-2.x-dev (2012-May-23) fixed this issue.
Comment #9
muschpusch CreditAttribution: muschpusch commentedWouldn't it be nice to have a working stable release :p?
Comment #10
Nicolas Bouteille CreditAttribution: Nicolas Bouteille commentedJust in case someone lands here... go there: http://drupal.org/node/1922808
Comment #10.0
Nicolas Bouteille CreditAttribution: Nicolas Bouteille commentedfixed a minor error in the bug description