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 fixed this by adding
if (!isset($file->metadata)) {
$file->metadata = array();
}
if (!isset($file->original->metadata)) {
$file->original->metadata = array();
}
to line 102 of file_entity.file.inc
Comment | File | Size | Author |
---|---|---|---|
#22 | interdiff-19-22.txt | 743 bytes | mxr576 |
#22 | file_entity_update-2375595-22.patch | 920 bytes | mxr576 |
Comments
Comment #1
rob_johnston CreditAttribution: rob_johnston commentedI stumbled into this error on the same line when deleting a field collection that contained an image (entity_delete_multiple). It seems that the file was deleted from the file_managed table but still existed in other tables (like file_metadata). I expect that when #2075791: Removing field collection item row with image field retains uploaded image is resolved then this won't be a problem, at least not for my case.
Comment #2
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedthanks for this. I was getting WSOD on the transliteration page, dmin/config/media/file-system/transliteration.
Comment #3
yan CreditAttribution: yan as a volunteer commentedExperiencing the same as #2. But the proposed solution is not very clear: Line 102 of which version? Could you provide a patch?
Comment #4
eric.chenchao CreditAttribution: eric.chenchao commentedI have put fix into a patch.
Comment #5
yan CreditAttribution: yan as a volunteer commentedPatch from #4 seems to solve the problem in my case!
Comment #6
reszlisame problem with WSOD on transliteration submit
patch #4 fixed the issue, thanks!
Comment #7
Finn Lewis CreditAttribution: Finn Lewis commentedI had the same error when trying to execute initial transliteration of files:
"Unsupported operand types in file_entity.file.inc on line 102"
The patch in #4 resolves this for me
Drupal 7.38
File Entity 7.x-2.0-beta1+30-dev
Transliteration 7.x-3.2
I guess this can be set to RTBC
Comment #8
Dave ReidComment #10
Dave ReidI don't understand how $file->original could not have the metadata array defined. It should always be loaded via file_load().
Comment #11
mariano.barcia CreditAttribution: mariano.barcia at ASM Web Services S.L. commentedThe patch in #4 resolves this for me as well.
Comment #12
rahu231086 CreditAttribution: rahu231086 commentedyes definitely it's a serious bug. I faced it when i try to migrate file from local file system to S3 by. And of-course patch #4 works for me too. we should take it to higher priority or increase it's level. So that it would be fixed in module too.
Comment #13
doitDave CreditAttribution: doitDave commentedThe patch works, and although I can sympathize with Dave in looking for a clearer picture of the issues in behind, this workaround makes my setup work where the release does not. Since I could neither see any potential issue in turning a potential NULL into an empty array, I would really like to remove the "patched" flag from the setup in question.
Comment #14
chriscalip CreditAttribution: chriscalip commentedTried #4 patch.
Got this error:
5679 Error Creating default object from empty value File /var/www/[redacted]/htdocs/profiles/cosc/modules/contrib/file_entity/file_entity.file.inc, line 105
Looking at the code its because object original to whom metadata is a property has not been initialized yet.
@see http://stackoverflow.com/questions/14806959/how-to-fix-creating-default-...
Response #10
My entry context is I am migrating file entities using drupal.org/project/migrate
This patch fixes #4 patch.
Comment #15
Dave ReidI'm still saying that if this bug is happening, it's because something else is not properly loading an existing file record using file_load() and then calling file_save() on it. It would be something that needs to be addressed in the calling code, because other things could be going wrong.
Comment #16
chriscalip CreditAttribution: chriscalip commentedresponse #15.
I am not familiar with the file_entity codebase. The issue is the $file object at this point does not come with a populated original property ($file->original) . What should the original property contain? is it the file object that is about to be updated? If so well in my context during the file migration process this $file->original object is not created yet.
Comment #17
chriscalip CreditAttribution: chriscalip commentedFixes patch #14 because it had the wrong condition check.
Comment #19
chriscalip CreditAttribution: chriscalip commentedFixes patch #14 because it had the wrong condition check; apparently i didnt hit save..
Comment #20
alrueden CreditAttribution: alrueden commentedChriscalip's patch at #19 worked for me. I've been getting the Unsupported operand error when using the S3 File System Migrate module to migrate image fields from the Drupal file system to Amazon S3. I thought the problem was between S3 File System Migrate and File (Field) Paths, but with this patch everything plays nice together. Thank you!
Comment #21
anbarasan.r CreditAttribution: anbarasan.r at NBCUniversal commentedGetting this error when we do file migration from D7 to D7
Comment #22
mxr576#19 worked to me as well. I've just made some code style cleanup on that patch.
Comment #23
3dnathaniel CreditAttribution: 3dnathaniel commented#22 worked to resolve my issue
Comment #24
Ollie222 CreditAttribution: Ollie222 commentedI've just come across this error when adding Transliteration module to an existing Drupal Commerce site and the error appeared when trying to transliterate the existing files.
The patch in #22 worked a treat for me so I'd love to see it included in the live version.
Comment #25
dieppon CreditAttribution: dieppon as a volunteer commentedI can confirm that #22 fixed my issue with Transliteration just like Ollie222 said.
Comment #26
nattsAlso confirming the patch in #22 worked on a Drupal Commerce (Commerce Kickstart v7.x-2.40) site that had a transliteration error, as per #23, #24 and #25.
Comment #27
TynanFox CreditAttribution: TynanFox as a volunteer commentedPatch in #22 worked for me as well, thank you! I was also trying to run transliteration on an existing commerce install and this took care of the problem.
Comment #28
joseph.olstadreviewing this now, waiting for test results
Comment #30
joseph.olstadin 7.x-2.x dev