Skip to main content
September 10, 2009
Question

Serialized Data

  • September 10, 2009
  • 2 replies
  • 1629 views

I have a database containing some arrays [actually nested arrays] of data that have been serialized using php serialize() function. [the entire array has been serialized]

is there any way for coldfusion to be able to deserialize this data?

here is a small example:

     a:1:{
     s:15:"info_buyRequest";
     a:6:{s:4:"uenc";
     s:128:"aHR0cDovL3d3dy5jYW5hZGFzYWxzYWNvbmdyZXNzLmNvbS9zaG9wL2J1eS1wYXNzL2EtbGEtY2FydGUtdGlja2V0cy5odG1sP29wdGlvbnM9Y2FydCZfX19TSUQ9VQ,,";
     s:7:"product";
     s:2:"72";
     s:15:"related_product";
     s:0:"";
     s:15:"super_attribute";
     a:1:{i:503;s:2:"24";}
     s:7:"options";
     a:1:{i:73;s:12:"xxxx xxxxxx";}
     s:3:"qty";s:1:"1";}
     }

-thanks

-sean

This topic has been closed for replies.

2 replies

Prasanth_Kumar_S
Inspiring
September 11, 2009

CF has functions to serialize and deserialize JSON  http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=functions_c-d_43.html. if you can pass JSON from PHP, you could directly deserialize the data in CF.

-Prasanth

September 11, 2009

yes - working on both Google [not a lot out there] and deserializing in php then serializing the data with php & json, it's a little confusing being the first time I have had to work with serialized data, ...  not a lot of luck on either front. 

oh btw, any idea what this is?

aHR0cDovL3d3dy5jYW5hZGFzYWxzYWNvbmdyZXNzLm NvbS9zaG9wL2J1eS1wYXNzL2EtbGEtY2FydGUtdGlja2V0cy5odG1sP29wdGlvbnM9Y2FydCZfX19TSU Q9VQ?
Inspiring
September 11, 2009

oh btw, any idea what this is?

aHR0cDovL3d3dy5jYW5hZGFzYWxzYWNvbmdyZXNzLm NvbS9zaG9wL2J1eS1wYXNzL2EtbGEtY2FydGUtdGlja2V0cy5odG1sP29wdGlvbnM9Y2FydCZfX19TS U Q9VQ?

It's some binary data that's been serialised.  Like an image or something like that (although there's not enough of it for it to be likely to actually be an image).

--

Adam

Inspiring
September 10, 2009

Sure, but not automatically.

My approach would be to get hold of the specification for the serialisation that PHP is performing, and write a function to reverse it (kind of an obvious statement that one, sorry).  It shouldn't be too complicated.

As PHP is open source, you should be able to get hold of the source for thw deseralise function, which will help you with the necessary logic to write your own version.

I also recommend checking on Google to make sure no-one else has already trod this ground.

--

Adam