[wp-trac] [WordPress Trac] #18210: Update_post_meta is case insensitive on meta_key, but get_post_meta is NOT
WordPress Trac
noreply at wordpress.org
Sun May 14 03:45:50 UTC 2017
#18210: Update_post_meta is case insensitive on meta_key, but get_post_meta is NOT
-------------------------------------------------+-------------------------
Reporter: anmari | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Database | Review
Severity: normal | Version: 3.2
Keywords: dev-feedback needs-patch needs- | Resolution:
unit-tests | Focuses:
| performance
-------------------------------------------------+-------------------------
Comment (by webaware):
I ran into a related problem with user meta. A client used a CSV importer
and accidentally capitalised the first letter of a meta key. Because case
insensitivity in MySQL, but case sensitivity in the WP user meta PHP code,
the billing last name would never load "for some users". Fixed with this
query, and a flush of the object cache:
{{{
update wp_usermeta
set meta_key = 'billing_last_name'
where meta_key collate utf8mb4_bin = 'Billing_last_name'
}}}
FWIW, I ran the query below on one of my testbed sites with over 200
plugins (multisite, lots of compatibility testing) and didn't find any
examples of plugins having user meta keys with capital letters.
{{{
select distinct meta_key
from wp_usermeta
where meta_key collate utf8mb4_bin regexp '[A-Z]'
}}}
Post meta is a different story, however; meta keys are sometimes directly
used on the front end, and thus may legitimately contain capital letters.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/18210#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list