Unserialize working on Windows but not Linux


I have a problem with the unserialize() function. On windows it is working fine but on linux it dosen't seem to work.

The string is just a series of timezones. This is the data:

a:27:{i:-11;s:40:"(GMT - 11:00 hours) Midway Island, Samoa";i:-12;s:40:"(GMT - 12:00 hours) Enitwetok, Kwajalien";i:-10;s:26:"(GMT - 10:00 hours) Hawaii";i:-9;s:25:"(GMT - 9:00 hours) Alaska";i:-8;s:45:"(GMT - 8:00 hours) Pacific Time (US & Canada)";i:-7;s:46:"(GMT - 7:00 hours) Mountain Time (US & Canada)";i:-6;s:45:"(GMT - 6:00 hours) Central Time (US & Canada)";i:-5;s:66:"(GMT - 5:00 hours) Eastern Time (US & Canada), Bogota, Lima, Quito";i:-4;s:58:"(GMT - 4:00 hours) Atlantic Time (Canada), Caracas, La Paz";s:4:"-3.5";s:37:"(GMT - 3:30 hours) Newfoundland (NST)";i:-3;s:65:"(GMT - 3:00 hours) Brazil, Buenos Aires, Georgetown, Falkland Is.";i:-2;s:57:"(GMT - 2:00 hours) Mid-Atlantic, Ascention Is., St Helena";i:-1;s:45:"(GMT - 1:00 hours) Azores, Cape Verde Islands";i:0;s:61:"(GMT) Casablanca, Dublin, Edinburgh, London, Lisbon, Monrovia";i:1;s:68:"(GMT + 1:00 hours) Berlin, Brussels, Copenhagen, Madrid, Paris, Rome";i:2;s:52:"(GMT + 2:00 hours) Kaliningrad, South Africa, Warsaw";i:3;s:51:"(GMT + 3:00 hours)Baghdad, Riyadh, Moscow, Nairobi";i:4;s:51:"(GMT + 4:00 hours) Adu Dhabi, Baku, Muscat, Tbilisi";i:5;s:61:"(GMT + 5:00 hours) Ekaterinburg, Islamabad, Karachi, Tashkent";i:6;s:42:"(GMT + 6:00 hours) Almaty, Colomba, Dhakra";i:7;s:42:"(GMT + 7:00 hours) Bangkok, Hanoi, Jakarta";i:8;s:63:"(GMT + 8:00 hours) Beijing, Hong Kong, Perth, Singapore, Taipei";i:9;s:56:"(GMT + 9:00 hours) Osaka, Sapporo, Seoul, Tokyo, Yakutsk";s:3:"9.5";s:26:"(GMT +9:30 hours) Adelaide";i:10;s:68:"(GMT + 10:00 hours) Melbourne, Papua New Guinea, Sydney, Vladivostok";i:11;s:59:"(GMT + 11:00 hours) Magadan, New Caledonia, Solomon Islands";i:12;s:63:"(GMT + 12:00 hours) Auckland, Wellington, Fiji, Marshall Island";}

Any ideas? On linux I get no array formed at all.
Who is Participating?
PAQed with points refunded (500)

Community Support Moderator
thepaddersAuthor Commented:
Just to add, this data is stored in the database - it comes out as a result set that I then try to unserialize but it does not work.

I am wondering if there is something wrong with the above or if there is a bug in unserialize().
Are the two servers using the same version of PHP?  What version is that?
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

thepaddersAuthor Commented:

The windows version is using PHP 5.1.1
The linux server is using PHP 4.4.2

But in the past people have mentioned the same problem on linux servers, but I am not sure with which other versions.
I'd try serializing the data on windows, then serializing the same data on linux, and compare the resulting strings.  Are they identical?
thepaddersAuthor Commented:
Seems the problem istn't with unserialize. The data is in XML and when I import it into a database on linux, for some reason the space after the closing bracket, ), just before Baghdad is lost. No idea why, very odd but that is what is breaking it.

I had looked before to try and see a difference, but hadn't noticed that one bit of whitespace that was missing.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.