Forum: Ruby PHP.unserialize's strange behaviour

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Milo T. (Guest)
on 2007-08-01 16:24
I have some code that needs to obtain information from a web service in
the form of an array of values to be plotted as a graph. The data I need
come back in the form of a string, as seen at So, the plan is to get at
the data using this code:

If I run PHP.unserialize(string) then I get an array of nil values.
PHP.serialize(PHP.unserialize(string)), or any equivalent, returns the
same string I started off with. Has anyone got any idea as to what would
cause this odd outcome?
Thomas H. (Guest)
on 2007-08-04 23:07
(Received via mailing list)
* Milo T. (removed_email_address@domain.invalid) wrote:

> to what would cause this odd outcome?
How is it odd?  You get the same thing unserializing in PHP.

Your string.txt: a:1920:{i:0;N;i:1;N;i:2;N; ... ;i:1918;N;i:1919;N;}

Read as: Array, 1920 elements, comprised of: integer key 0, NULL value,
integer key 1, NULL value, integer key 2, NULL value...
Milo T. (Guest)
on 2007-08-04 23:33
Thomas H. wrote:
> How is it odd?

Unfortunately for me it seemed odd because I cocked up and was causing a
different string to be passed to my PHP and Ruby scripts without
noticing the difference.
Looking silly therefore serves me right, I suppose. :$
This topic is locked and can not be replied to.