[wp-hackers] Wordpress seems to serialize image_meta of a featured image incorrectly
jbutkus at time.ly
Sat Mar 8 01:11:12 UTC 2014
Actually just the first case is correct, where length is set to 7 bytes,
because copyright symbol (©) takes up two bytes.
While it's encoded in HTML as "©" it's not necessarily copyright
symbol at 169th position in ASCII table (what `chr` returns).
So second encoding is incorrect and if you try to paste it into some PHP
console you may randomly get an error "PHP Notice: unserialize(): Error
at offset 11 of 14 bytes" in some cases, while first example should
unserialize without any errors.
2014.03.08 02:52, Jeff Tchang rašė:
> 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?
More information about the wp-hackers