Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#23495 closed defect (bug) (duplicate)

Special characters can truncate WP Option value

Reported by: tobiasbg's profile TobiasBg Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Database Keywords:
Focuses: Cc:


I recently experienced something weird when adding a string from a foreign language as the value of a WP Option.
Try this:

add_option( 'weird_character_test', 'test1

Change History (4)

#1 @scribu
11 years ago

Can't reproduce using trunk; also have "utf8_general_ci".

#2 @TobiasBg
11 years ago

  • Keywords close added

Thanks for testing.

I've played with this some more, and it seems more of a mySQL thing.
I can confirm it on several different sites, with the easiest way being copying the string


#3 @scribu
11 years ago

I can reproduce via wp-admin/options.php (previously, I used wp-cli).

#4 @SergeyBiryukov
11 years ago

  • Component changed from General to Database
  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I could reproduce with a PHP script on a second page load. I guess the first one printed a cached value, which might explain comment:1. Also reproduced via wp-admin/options.php.

When trying to insert the suggested value using phpMyAdmin, I get a warning:

Warning: #1366 Incorrect string value: '\xF0\xA0\x86\xA2te...' for column 'option_value' at row 1

So, it's a 4-byte character, and this ticket a duplicate of #13590. #21212 would fix this.

Note: See TracTickets for help on using tickets.