Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

Unserialize working on Windows but not Linux

Hi,

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.
0
thepadders
Asked:
thepadders
  • 3
  • 2
1 Solution
 
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().
0
 
snoyes_jwCommented:
Are the two servers using the same version of PHP?  What version is that?
0
 
thepaddersAuthor Commented:
No,

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.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
snoyes_jwCommented:
I'd try serializing the data on windows, then serializing the same data on linux, and compare the resulting strings.  Are they identical?
0
 
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.
0
 
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now