warmshowers / Warmshowers.org

The code for warmshowers.org. If you'd like to help develop code for Warmshowers.org or if you would like to handle some of the website configuration/sitebuilding tasks in the issue queue, please let me know.
http://www.warmshowers.org
60 stars 22 forks source link

UTF-8 4-byte emoji causing PDOException #940

Closed rfay closed 8 years ago

rfay commented 8 years ago

We still see PDOExceptions showing up in various places where people try using emoticons/emoji, Utf-8 4-byte things that are incompatible with current mariadb/Drupal7 settings. I think we should probably

Previous related issues with workarounds: #574, #755, #881, #891

Oct 27 01:04:44 warmshowers drupal: type=php message="PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect string value: '\xF0\x9F\x98\x8A! ' for column 'body_value' at row 1: INSERT INTO {field_data_body} (entity_type, entity_id, revision_id, bundle, delta, language, body_value, body_summary, body_format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array#012(#012 [:db_insert_placeholder_0] => node#012 [:db_insert_placeholder_1] => 121656#012 [:db_insert_placeholder_2] => 132630#012 [:db_insert_placeholder_3] => trust_referral#012 [:db_insert_placeholder_4] => 0#012 [:db_insert_placeholder_5] => und#012 [:db_insert_placeholder_6] => Thanks a lot for your hospitality. We had a good moment with you. We enjoy the visit of your garden and the warm atmosphere of your living room ! Thanks for everything and adventure, fun and safety! ?! #012 [:db_insert_placeholder_7] => #012 [:db_insert_placeholder_8] => 1#012)#012 in field_sql_storage_field_storage_write() (line 514 of /var/www/warmshowers.org/docroot/modules/field/modules/field_sql_storage/field_sql_storage.module)." request_uri=https://fr.warmshowers.org/node/add/trust-referral?edit%5Bfield_member_i_trust%5D%5Bund%5D%5B0%5D%5Buid%5D=adftas referrer=https://fr.warmshowers.org/node/add/trust-referral?edit%5Bfield_member_i_trust%5D%5Bund%5D%5B0%5D%5Buid%5D=adftas uid=104017 link= timestamp=1445929483

rfay commented 8 years ago

First step - database + tables, http://dba.stackexchange.com/a/21684 and https://mathiasbynens.be/notes/mysql-utf8mb4

rfay commented 8 years ago

I was a bit overwhelmed by what it was going to take to reliably refactor the db. I didn't realize that indexes had to be adjusted and all that. So bailed and just used hook_presave for nodes and comments. That means, of course, that we might still find more of these.