Opened 17 years ago
Closed 15 years ago
#6394 closed defect (bug) (duplicate)
Leading and trailing white space in values of custom fields should not be trimmed
Reported by: | aercolino | Owned by: | markjaquith |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Administration | Keywords: | meta value, custom field |
Focuses: | Cc: |
Description
Custom fields that begin or end with white space in their key or value are trimmed.
I can undestand that a key is more easily dealt with if it is trimmed before saving it into the database. But values should definitely retain all their white space AS IS.
Suggested Fix
http://trac.wordpress.org/browser/trunk/wp-includes/functions.php#L405 (7508)
function maybe_serialize($data, $trim = true) { //was maybe_serialize($data)
http://trac.wordpress.org/browser/trunk/wp-includes/functions.php#L406 (7508)
if ( $trim && is_string($data) ) //was if ( is_string( $data ) )
http://trac.wordpress.org/browser/trunk/wp-admin/includes/post.php#L365 (7458)
$metavalue = maybe_serialize( stripslashes( ( $_POST['metavalue'] ) ), false ); //was $metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
http://trac.wordpress.org/browser/trunk/wp-admin/includes/post.php#L449 (7458)
$mvalue = maybe_serialize( stripslashes( $mvalue ), false ); //was $mvalue = maybe_serialize( stripslashes( $mvalue ));
Change History (3)
Note: See
TracTickets for help on using
tickets.
Do not fix what is broken. I suggest to remove maybe_serialize(). This function is absolutely esoteric and undocumented with a high potential of fuzz.