Problem:
If an image is saved and the image toolkit fails to determine for example the width, the field is tried to be saved with the value "NULL" in the column for "width". This is not a correct integer value.
Steps to reproduce:
There are 2 ways to reproduce this:
- Add a node with an image field. Upload an image that is 0 bytes (for example). Make sure you actually click the upload button, so the ajax processing occurs.
- Click save.
The other way is this:
- Add a node with an image field. Upload an image that is 0 bytes.
- When you edit this node, it will never end up saving again.
Suggested solution:
Make sure we only save width and height if it is est to something sensible.
Original title (and report) by guaka:
General error: 1366 Incorrect integer value: '' for column 'field_image_width' at row 1
| Comment | File | Size | Author |
|---|
Comments
Comment #1
guaka commentedThis is related: "Warning: array_merge(): Argument #1 is not an array in image_styles() (line 582 of modules/image/image.module)."
Comment #2
okokokok commentedThe Warning: array_merge(): Argument #1 is not an array in image_styles() occurs sometimes, inside the node/x/edit form, right after the file is uploaded.
General error: 1366 always occurs right after the node is saved (so it's probably not saved).
File system and permissions look fine.
Comment #3
okokokok commentedfixed after choosing GD in admin/config/media/image-toolkit
would be nice if this would be handled more gracefully
Comment #4
joachim commentedThis can actually also occur if a user tries to upload an image that isn't one.
For instance, I wanted to try uploading a large image file, and as I didn't have one large enough I just took a 3MB PDF and changed the file extension. Trying to upload it got this error.
Obviously, this is PEBCAK, but the user should get an error message, not a crash.
Comment #5
chris dartKasper, what do you mean by "choosing GD in admin/config/media/image-toolkit"? This doesn't exist in my system, and I can't find a module with this name.
Comment #6
davi.uezono commentedWe were getting errors when trying to create new node with non-required image fields. Exactly the same scenario, after a D7 migration.
This fixed our problems. Try to execute the script on your site using drush.
Comment #7
cilefen commentedI tagged this issue for some needed issue summary updates.
Comment #8
eiriksmUpdated the IS.
Comment #9
eiriksmComment #10
eiriksm...and here is a patch that fixes the problem. Maybe needs tests?
Comment #11
eiriksmComment #12
eiriksmFor the record. This error does not happen on Drupal 8 (at least not in the same way - that being, the site seemingly crashes in Drupal 7).
In Drupal 8 you are presented with this error (attached). Maybe not the best error message, but at least it does not crash your site.
Comment #13
cilefen commentedIs this a duplicate of #681042: Notice when viewing an uploaded image of 0 bytes?
Comment #14
eiriksmNot really. I guess that describes and covers the d8 part of it.
In D7 this will give you a "maintenence page" with the error message like the original issue title. Patch is for d7
Comment #15
davi.uezono commentedIt seems to happen after migrating a website from Drupal 6 to Drupal 7 using those automatic migration scripts.
This issue is related to default_value of this fields, that tries to save an enpty string on Drupal 6 database, but the field on Drupal 7 database in an integer.