[wp-trac] [WordPress Trac] #18210: Update_post_meta is case insensitive on meta_key, but get_post_meta is NOT
WordPress Trac
wp-trac at lists.automattic.com
Fri Jul 22 07:05:28 UTC 2011
#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 Review
Component: General | Version: 3.2.1
Severity: normal | Keywords:
--------------------------+-----------------------------
In WordPress 3.3-aortic-dissection and 3.2.1
get_post_meta is case sensitive on the meta-key
BUT
update_post_meta is NOT case sensitive
Thus If there is a pre-existing meta record with a key in say UPPERCASE,
then one can issue an update for a lowercase key that one can not then
fetch as it does not exist - only the uppercase key exists.
Example Code
{{{
$meta = get_post_meta ($post->ID, '_allday');
if ($meta ) { echo '<br />got lower: '; var_dump($meta);
}
$meta = get_post_meta ($post->ID, '_ALLDAY');
if ($meta ) { echo '<br />got upper: '; var_dump($meta);
}
update_post_meta (21, '_allday','Tried to update lowercase');
$meta = get_post_meta ($post->ID, '_allday');
if ($meta ) { echo '<br />got lower: '; var_dump($meta);
}
else { echo '<br />Tried to get lower but no go';
}
$meta = get_post_meta ($post->ID, '_ALLDAY');
if ($meta ) { echo '<br />Still have upper: '; var_dump($meta);
}
}}}
Output of above:
got upper: array(1) { [0]=> string(14) "tis the upper." }
Tried to get lower but no go
Still have upper: array(1) { [0]=> string(25) "Tried to update lowercase"
}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18210>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list