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.


davisben’s picture

Status: Active » Closed (duplicate)
davisben’s picture

Status: Closed (duplicate) » Fixed

Actually, it looks like this was still persisting. Fixed now.

marty.true’s picture

When 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?

davisben’s picture

The 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.

marty.true’s picture

Okay, thanks for the quick reply :)

Status: Fixed » Closed (fixed)

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

damien_vancouver’s picture

Title: PDO Exception: Incorrect integer value » PDO Exception: Incorrect integer value: '' for column 'weight' at row 1 INSERT INTO {weight_weights} .....

I 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:

PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'weight' at row 1: INSERT INTO {weight_weights} (entity_id, entity_type, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 4951 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => ) in _weight_set_weight() (line 434 of /home/www/sites/all/modules/weight/weight.module).

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...

BD3’s picture

I 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.

muschpusch’s picture

Wouldn't it be nice to have a working stable release :p?

Nicolas Bouteille’s picture

Just in case someone lands here... go there: http://drupal.org/node/1922808

Nicolas Bouteille’s picture

Issue summary: View changes

fixed a minor error in the bug description