Opened 3 years ago
Last modified 3 years ago
#12302 new defect (bug)
add_metadata() Fails to Store Serialized Values as BINARY
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | high | Milestone: | Future Release |
| Component: | Database | Version: | |
| Severity: | critical | Keywords: | needs-patch |
| Cc: |
Description
Symptoms:
WordPress stores corrupt values in post_metadata if there are any non-UTF-8 bytes in the meta_value.
Steps to reproduce:
Call add_metadata() with non-UTF-8 values such as a latin-1 copyright char.
Even though the serialized string goes through prepare() before the query, MySQL is required to truncate the invalid value being assigned to the meta_value field. The result is that the stored value can never be un-serialized.
This behavior can also be replicated by trying to inject CHAR(169) into any UTF-8 table query.
Change History (4)
comment:1
miqrogroove — 3 years ago
- Summary changed from add_metadata() Fails to Validate Inputs Before Serializing Them to add_metadata() Fails to Store Serialized Values as BINARY
comment:2
miqrogroove — 3 years ago
similar bugs referenced here: #9549
Note: See
TracTickets for help on using
tickets.

After giving this some thought, I've come to the conclusions: