{"_id":"php-unserialize","_rev":"13-2a57696ca715411d2c1c9e8bac2df824","name":"php-unserialize","description":"tool to unserialize data taken from PHP. It can parse \"serialize()\" output, or even serialized sessions data.","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"author":{"name":"Nicolas Chambrier","email":"naholyr@gmail.com","url":"http://naholyr.fr"},"name":"php-unserialize","description":"tool to unserialize data taken from PHP. It can parse \"serialize()\" output, or even serialized sessions data.","version":"0.0.1","repository":{"type":"git","url":"git://github.com/naholyr/js-php-unserialize.git"},"main":"php-unserialize.js","scripts":{"test":"./node_modules/.bin/_mocha -R list -u bdd"},"dependencies":{},"devDependencies":{"chai":"~1.3.0","mocha":"~1.7.0"},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"naholyr","email":"naholyr@gmail.com"},"_id":"php-unserialize@0.0.1","_engineSupported":true,"_npmVersion":"1.1.24","_nodeVersion":"v0.8.10","_defaultsLoaded":true,"dist":{"shasum":"297e8e6964673adc8282201e45ce0245b3856084","tarball":"https://registry.npmjs.org/php-unserialize/-/php-unserialize-0.0.1.tgz","integrity":"sha512-aZWuX3gQ30Dui+Lff19q0jeu+3DHpSYXFEQPkeAx4WAyDtAp5VI30ZPC5wb4OrcHy6KUiZIRFRTWkvK8l8l6Rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFkvaAI7DO0cCK4KVN+DPeeN6jzuoQ9fqi9Q8niYLxGyAiApBHA1jut6zSBtlLMNkwleRjn9eUQ3K1RrPnYV84hzIQ=="}]},"maintainers":[{"name":"naholyr","email":"naholyr@gmail.com"}]}},"readme":"js-php-unserialize\n==================\n\n[![Build Status](https://secure.travis-ci.org/naholyr/js-php-unserialize.png)](http://travis-ci.org/naholyr/js-php-unserialize)\n\nJavaScript tool to unserialize data taken from PHP. It can parse \"serialize()\" output, or even serialized sessions data.\n\nCredits\n-------\n\n* The PHP unserializer is taken from [kvz](https://github.com/kvz)'s [phpjs](https://github.com/kvz/phpjs) project.\n* The session unserializer's idea is taken from [dumpling](https://raw.github.com/st-luke/dumpling/), which is highly limited by its lack of a real unserializer, and has lot of crash cases.\n\nInstallation\n------------\n\n### Node.js\n\nInstall from npm :\n\n```sh\nnpm install php-unserialize\n```\n\nThe use it the usual way :\n\n```javascript\nvar PHPUnserialize = require('php-unserialize');\n\nconsole.log(PHPUnserialize.unserialize('a:0:{}')); // {}\n```\n\n### Browser\n\n[Download tarball from github](https://github.com/naholyr/js-php-unserialize/downloads) and then unarchive this where you want, then you can simply include it in your page :\n\n```html\n<script src=\"/path/to/php-unserialize.js\"></script>\n<script>\n  console.log(PHPUnserialize.unserialize('a:0:{}')); // {}\n</script>\n```\n\n**Compatibility issues**\n\nThis library has been tested server-side only. For example it uses `[].reduce`, so it may not work on some browsers. Do not hesitate to make pull requests to fix it for you favorite browsers :)\n\n### Notes\n\n* Note that `array()` will be converted to `{}` and not `[]`. That can be discussed as `array()` in PHP has various significations. A choice had to be done, but it may change in the future (cf. next point).\n* A less obvious conversion is `array('a', 'b')` which will be converted to `{\"0\": \"a\", \"1\": \"b\"}`. Quite annoying, and it will be fixed if necessary (this means I won't work on this issue unless you really need it, but I agree this is not normal behavior).\n\nUsage\n-----\n\nThe module exposes two methods:\n\n### `unserialize(string)`\n\nUnserialize output taken from PHP's `serialize()` method.\n\nIt currently does not suport objects.\n\n### `unserializeSession(string)`\n\nUnserialize PHP serialized session. PHP uses a weird custom format to serialize session data, something like \"`$key1$serializedData1|$key2$serializedData2|…`\", this methods will parse this and unserialize chunks so you can have a simple anonymous objects.\n","maintainers":[{"name":"naholyr","email":"naholyr@gmail.com"}],"time":{"modified":"2022-06-23T22:01:26.312Z","created":"2012-11-14T12:36:47.156Z","0.0.1":"2012-11-14T12:36:49.417Z"},"author":{"name":"Nicolas Chambrier","email":"naholyr@gmail.com","url":"http://naholyr.fr"},"repository":{"type":"git","url":"git://github.com/naholyr/js-php-unserialize.git"},"users":{"quintonparker":true,"irnnr":true,"acollins-ts":true,"cpxpratik":true}}