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.
While testing a recent media upgrade we noted this error when randomly uploading cat videos. Any that happen to have emojis in the title throw an sql-error.
https://www.youtube.com/watch?v=P2RkTCHTLbY
https://www.youtube.com/watch?v=-x7GjsfGvLE
The following error appears:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xF0\x9F\x98\xB9 F...' for column 'filename' at row 1
Notice: Undefined index: upload in file_entity_add_upload_submit() (line 349 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.pages.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/rcaoj/www/includes/entity.inc).
Notice: Trying to get property of non-object in file_entity_file_type() (line 45 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.file.inc).
Notice: Trying to get property of non-object in file_entity_file_type() (line 45 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.file.inc).
Notice: Trying to get property of non-object in file_entity_file_type() (line 45 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.file.inc).
Notice: Trying to get property of non-object in file_entity_file_type() (line 45 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.file.inc).
Notice: Undefined index: upload in file_entity_add_upload_submit() (line 349 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.pages.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/rcaoj/www/includes/entity.inc).
Notice: Trying to get property of non-object in file_entity_file_is_writeable() (line 2232 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.module).
Notice: Trying to get property of non-object in file_entity_add_upload_submit() (line 379 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.pages.inc).
Notice: Undefined index: upload in file_entity_add_upload_submit() (line 405 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.pages.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/rcaoj/www/includes/entity.inc).
Notice: Undefined index: upload in file_entity_add_upload_submit() (line 430 of /home/rcaoj/www/sites/all/modules/file_entity/file_entity.pages.inc).
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/rcaoj/www/includes/entity.inc).
An error occurred and no file was uploaded.
I have verified this error with a clean install of media_youtube 7.x-3.4 w/ Drupal 7.55 on simplytest.me
Contrib Dependencies installed:
- File Entity 7.x-2.2
- Media 7.x-2.8
Comments
Comment #2
steinmb CreditAttribution: steinmb as a volunteer commentedFirst make sure you got - https://www.drupal.org/node/2754539 working.
Comment #3
reszliIn my case, it was not possible to achieve Multi-byte UTF-8 support on the server, so I needed to work around it
My solution was to replace the original YouTube provider with a custom one that extends the original one and strips non-ASCII characters from the filename on preSave() method.
add these hook implementations to mymodule.module file
create a new file under mymodule/includes/MymoduleMediaInternetYouTubeHandler.inc with the following content:
Comment #4
steinmb CreditAttribution: steinmb as a volunteer commentedThat should work :) - I'll going to close this. Only one post in 6 years :)