Need help with unserialize
Posted: Mon Aug 13, 2007 10:06 am
Hi,
It seems storing integers over the unsigned limits results in errors when unserializing an 'array string'. I.e. this code:Would result in the browser outputting a faulty value for the key "value", while this code will output the correct value.
So I figured I could add something like this for the bigger ints:
but that won't work very well in the long run either, as only signed integers would work then..
So..: how should i go about unserializing an array with big integers? is there some easier way to store arrays with big ints in a database?
thanks, aye
It seems storing integers over the unsigned limits results in errors when unserializing an 'array string'. I.e. this code:
Code: Select all
<?php
$test = unserialize('a:1:{s:5:"value";i:2147483648;}');
print_r($test);
?>Code: Select all
<?php
$test = unserialize('a:1:{s:5:"value";i:2147483647;}');
print_r($test);
?>So I figured I could add something like this for the bigger ints:
Code: Select all
$diff = 2147483648 + $test["value"];
$test["value"] = $diff + 2147483648;So..: how should i go about unserializing an array with big integers? is there some easier way to store arrays with big ints in a database?
thanks, aye