I am using WordPress update_post_meta to save an array like
$obj = array(
'array' => array(1, 'zwei', !!3),
'string' => 'abc',
'bool' => true,
'bool2' => false,
'integer' => 1,
'integer2' => 17
);
update_post_meta($post_ID, 'my-key', $obj);
however, if I check the source field, I get
a:6:{s:5:"array";a:3:{i:0;i:1;i:1;s:4:"zwei";i:2;s:1:"1";}s:6:"string";s:3:"abc";s:4:"bool";s:1:"1";s:5:"bool2";s:1:"0";s:7:"integer";i:1;s:8:"integer2";i:17;}
while he should be
a:6:{s:5:"array";a:3:{i:0;i:1;i:1;s:4:"zwei";i:2;b:1;}s:6:"string";s:3:"abc";s:4:"bool";b:1;s:5:"bool2";b:0;s:7:"integer";i:1;s:8:"integer2";i:17;}
You may notice that all booleans are stored as a string ( b:1 = s:1:"1")
The problem is only in some installations of WordPress, and not at all. I also checked the serialize function , which works correctly (returns b:1)
Also using get_post_meta
get_post_meta($post_ID, 'my-key', true);
and check the value with is_bool returns false (obviously)
EDIT: just noticed that integers are stored as strings