[wp-hackers] Wordpress seems to serialize image_meta of a featured image incorrectly

Otto otto at ottodestruct.com
Sat Mar 8 07:00:53 UTC 2014


On Fri, Mar 7, 2014 at 6:52 PM, Jeff Tchang <jeff.tchang at gmail.com> wrote:
>
> Noticing some odd behavior when I upload an image with meta information.
> One of the fields has "© 2013".
>
> When it is serialized to the database I see:
>
> s:7:"© 2013";
>
> When I do this in vanilla php:
>
> $a = chr(169) . " 2013";
> echo serialize($a);
>
> I get
>
> s:6:"© 2013";
>
> which seems like the correct serialization. Has anyone run into this before?
>


You're comparing different character sets.

In ASCII, the copyright symbol is the character with code 0xA9.

In UTF-8, the copyright symbol is the character with code 0xC2 0xA9.

That extra byte is relevant to the serialization that you're seeing.

-Otto


More information about the wp-hackers mailing list