Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Serialized Data

Guest
Sep 10, 2009 Sep 10, 2009

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

TOPICS
Advanced techniques
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 10, 2009 Sep 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 10, 2009 Sep 10, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 11, 2009 Sep 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?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 11, 2009 Sep 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 11, 2009 Sep 11, 2009
LATEST

it is....  but I have not been able to decode it to anything recognizable - I think it might be paypal return data.... not sure.

but the good news is;

the php serialized data can be deserialized, and then serialized as wddx data

$tmp = unserialize($query['query_col']);
print wddx_serialize_vars('tmp');

written to a file like that cfmx can read that automagically so all I need to do is write a php webservice [argh!?] to provide the wddx serialized data.

-sean

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources