When I convert nodes I get the following errors:
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /var/www/vhosts/machines7/includes/entity.inc).
Notice: Trying to get property of non-object in file_field_presave() (line 221 of /var/www/vhosts/machines7/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 575 of /var/www/vhosts/machines7/includes/file.inc).
Caught exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2
The conversion seems to work properly though.
I don't see these messages at any other time.
The content types being converted are pretty simple and have the body field, 1 or 2 text fields, a taxonomy field and an image field.
I am using:
drupal 7.0
node_convert 7.x-1.0
Also, the site was a drupal 5 site upgraded to drupal 6 and then drupal 7 (in case that matters).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | node_convert.1120406.9.patch | 1.76 KB | jamsilver |
| #3 | node_convert-drupal_debug-1120406-3.txt | 1.41 MB | agileware |
Comments
Comment #1
agileware commentedThis related error occurs as well:
Comment #2
agileware commentedSome debugging shows that the issue is cause by my image field, which is a new image field in D7 (it didn't get migrated from older drupal versions).
* The array_flip error (entity.inc):
$ids is supposed to be an array but in this case is the boolean TRUE value.
* The property of non-object error (file.field.inc):
The $file variable is boolean FALSE instead of an object because the $items array is
so it is loading a nothing file.
* The undefined property error (file.inc):
The $file->uri property doesn't exist because the $file object is only:
Comment #3
agileware commentedHere is a quick debug_backtrace() for each of the errors.
Each one is prefixed by filename backtrace (ie. entity.inc backtrace) so you can navigate the file a little easier.
Comment #4
CatherineOmega commentedI'm also having this problem, on a from-scratch D7 site, on nodes with Image/Filefield. Same error messages. Ideas?
Comment #5
CatherineOmega commentedI do note that EDITING the newly-converted node and then saving it results in no errors whatsoever afterwards.
Comment #6
topazzz commentedHaving the same issue when converting image fields. In my case the fields were empty. Here is what I got
Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /includes/entity.inc).
Notice: Trying to get property of non-object in file_field_presave() (line 221 of /modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 575 of /includes/file.inc).
Caught exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri'
Comment #7
vml-bsummers commentedany updates on this? I am experiencing the same issues and can confirm the same behaviors as in #5
Comment #8
dave reidI've confirmed that this bug is encountered when converting a node type that has an image field. Re-saving the node after conversion seems to fix the invalid field data.
Comment #9
jamsilver commentedThe error in question seems to arise only when dealing with nodes which did not have a value for an image/file field.
The attached patch fixed it for me.
Note, in the code this error was causing an exception which was aborting the node_save process, which is having strange effects like e.g. pathauto aliases not getting recomputed for the node.
Comment #10
kenorb commentedSee: #1163740: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 2: INSERT INTO {file_managed}
Comment #11
donquixote commentedI have the same issue with taxonomy fields.
I save them, and the error is gone.
Debug backtrace shows that the node taxonomy field is broken. It is something like
and nothing else in that field.
Part of the stack trace:
I think it would be preferable if node_save() (and thus, entity_save etc) would take care to clean up those broken fields, or complain that it's broken.
Apparently they just silently save the broken thing.
Comment #12
mikerb commentedI had this problem too. After converting a node, if there were no entries for tags, a null value was inserted into field_tags_tid in the field_data_field_tags table. I tried using node_save() to update all the affected nodes, but it failed too because of the null values. I ended up deleting these rows in the field_data_field_tags table, which fixed the problem.
Comment #13
yan commented#9 seems to work perfect for me, thanks. I always got many error messages and after that the strange behaviour that was described before: Some nodes with empty fields didn't show up in taxonomy lists until I saved them. I applied the patch (manually) and after that there are no error messages and the converted nodes appear as they should.
Comment #14
yan commentedI just saw that the change from #9 is already in dev, so I guess this issue is fixed.
Comment #16
nevergoneDrupal core patch: https://drupal.org/node/1443158#comment-6955596
Comment #17
nevergonesorry