Got an issue when inserting a blank serialized array into the database. I'm using wordpress (just for full disclosure, shouldn't make a difference) and using the add_post_meta() function to input some additional information. Here's a snippet:
add_post_meta($post_id, 'information', serialize(array()));
The serialized array is intentionally blank for the moment. Anyway here's the expected/actuals:
// Expected value
a:0:{}
// Actual value
s:6:"a:0:{}";
Any help?
s:6comes from this -a:0:{}, a string that is 6 characters long. I believe you don't need to serialize array data withadd_post_meta(). You could also trymaybe_serialize();.