I try to serialize object data to be saved into a file by php using serialize package by PHP.js.
Chrome: fine FF: fine IE9: fine IE9 in compatibility mode (essentially IE7): not fine.
Error from console:
SCRIPT5022: Exception thrown and not caught
serialize.min.js, line 144 character 55
Serialized the data basically looks like this:
a:180:{s:40:"Aleksis Kiven tie 15<br>04200 Kerava<br>";a:2:{i:0;d:60.4012598;i:1;d:25.09659910000005;}
Unserialized:
{"Aleksis Kiven tie 15<br>04200 Kerava<br>": [60.4012598, 25.09659910000005]}
Javascript that handles the caching looks like this:
function saveCache(data) {
sdata = serialize(data);
$.ajax({
type: 'POST',
url: 'http://localhost/foobar/files/coordinates.php',
data: {
'do': 'write',
'data': sdata
}
});
}
I'm caching geocoding results by address into a text file.
Please ask more if I'm not making sense.
MAJOR EDIT: I corrected the examples as pointed out. Also the major thing is that the issue really changed; it isn't actually an issue with serialize(), but with unserialize().