[wp-trac] [WordPress Trac] #7133: maybe_serialize does not match with maybe_unserialize

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 13 05:24:36 GMT 2008

#7133: maybe_serialize does not match with maybe_unserialize
 Reporter:  hakre    |       Owner:  hakre
     Type:  defect   |      Status:  new  
 Priority:  high     |   Milestone:  2.5.2
Component:  General  |     Version:       
 Severity:  normal   |    Keywords:       
 maybe_serialize is used in conjunction with maybe_unserialize. from a
 logical point of view, data passed through both functions should be
 returned unchanged:

 $data_original = ' original ';
 $data = maybe_serialize($data_original);
 $data = maybe_unserialize($data);

 printf('Original:"%s" Processed:"%s"', $data_original, $data);

 the output is:
 Original:" original " Processed:"original"

 this example shows that data has been unecessarily manipulated.

 when you look into the code you can see that maybe_serialize() trims the
 $data. this is of no use.

  # to trim a string use trim() php function
  # serialization is about arrays and objects, not strings

Ticket URL: <http://trac.wordpress.org/ticket/7133>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list