After upgrading from 2.1 to 2.2 I started encountering this error when trying to edit a node:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'weight' at row 1: UPDATE {weight_weights} SET weight=:db_update_placeholder_0 WHERE ( (entity_id = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => [:db_condition_placeholder_0] => 58 ) in _weight_set_weight() (line 544 of C:\inetpub\wwwroot\sites\all\modules\weight\weight.module).
The site was originally upgraded from Drupal 6 which also used the Weight module. However the error just started appearing after the recent upgrade from 2.1 to 2.2. I had to disable the module to allow node edits. Please let me know if I can provide any other useful information. Is it possible to downgrade to 2.1 with out any ill effects?
Comment | File | Size | Author |
---|---|---|---|
#11 | 1922808-11.patch | 680 bytes | valthebald |
Comments
Comment #1
toshubuntu CreditAttribution: toshubuntu commentedSame problem for me after upgrading to 2.2. I can't modify any previous node without having that same identical message:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'weight' at row 1: UPDATE {weight_weights} SET weight=:db_update_placeholder_0 WHERE ( (entity_id = :db_condition_placeholder_0) ); Array ( [:db_update_placeholder_0] => [:db_condition_placeholder_0] => 53 ) in _weight_set_weight() (linea 544 di /srv/data/web/vhosts/*******/htdocs/sites/all/modules/weight/weight.module).
I have a unique content type using Weight for all nodes created.
I deactivated Weight at the moment because my site is till in dev.
Drupal 7.20 | Firefox 19.0 | MYSQL 5.5.28-1-log - (Debian)
Comment #2
vegancheesesteak CreditAttribution: vegancheesesteak commentedMy issue is on a live site. I've had to disable Weight for now so we can make content revisions.
Is it safe to downgrade to 2.1?
Comment #3
nessunluogo CreditAttribution: nessunluogo commentedI had this problem too in a fresh installation.
Turning off the "Use Menu Weight" fixed my problem.
Hope this helps.
Comment #4
davisbenThis is occurring when menu weight is enabled, but the node being saved doesn't have a menu link. I added a check to set the weight to the default if there is no menu link.
Comment #6
ellolo CreditAttribution: ellolo commentedI just encountered this exception with version 7.x-2.2 when trying to unpublish a node or setting a different weight:
I modified a few lines in the file "weight.module" to make it work, though I am not sure that I correctly handle "menu_links". In the function _weight_set_weight($node), around line 520, I wrote this:
The modification involves:
1/ some replacements of the variable '$weight' with '$weight_query' to avoid mixing of different meanings for a same variable and avoid that '$weight' contains a query instead of an integer
2/ a test of what the query found. On my website, it is possible that no record was returned so FALSE is obtained.
With these modifications, db_merge() does not fail anymore.
Comment #7
Nicolas Bouteille CreditAttribution: Nicolas Bouteille commentedThe bug also happens when the translation sync is enabled even if the menu weight is disabled.
Comment #8
davisbenThe fix for this was committed after 7.x-2.2 was released, so it isn't in that version. Using 7.x-2.x-dev will fix this, or you can wait for 7.x-2.3, which will be out in a week or two.
Comment #9
phoenix CreditAttribution: phoenix commentedI have a Drupal site with the weight module. I had the same PDO exception. Now installed 7.x-2.x dev snapshot and I still have this problem.
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] => 486 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => ) in _weight_set_weight() (line 592 of ......../contrib/weight/weight.module).
Comment #10
phoenix CreditAttribution: phoenix commentedI checked the code. I created a new translation, translated the node, push submit and get the error. When checking line 592, I see a merge query and apparently it doesn't have a weight.
Just before this query I see this:
_weight_get_weight($node->tnid);
When checking the _weight_get_weight function, it will try to retrieve the weight via a query, but this node doesn't exist yet...
So nothing is returend. I added this piece of code after this query:
I know it is not fully correct, as the weight will always be 0 when a new translated node is submitted.
Maybe we can try to get the weight from the node object. But I don't know which property that is.
Comment #11
valthebaldIt may happen that variable_get() returns boolean FALSE (which caused this error in my install)
Attached patch makes explicit cast in weight_update_7200()
Comment #12
13rac1 CreditAttribution: 13rac1 commentedWorks and applies to latest dev.
Comment #13
davisbenThanks for the patch!
Comment #15
MastaP CreditAttribution: MastaP commentedWas this issue ever fixed into a recent update?
I am getting
thanks.
Comment #16
bessone CreditAttribution: bessone commentedI have the same problem changing the node's weight in a View with Weight 7.x-2.3
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] => 271 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => ) in _weight_set_weight() (linea 592 di /var/www/xxx/sites/all/modules/weight/weight.module).