Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
@roblabla/php-serialization
Advanced tools
A library used to serialize and unserialize like it was in php (especially useful for manipulating laravel sessions stored with redis server)
Javascript tool to unserialize php serialized data, or to serialize data the way php does. This was originally used in manipulating php session stored in redis server.
Install from npm:
npm install php-serialization
var unserialize=require("php-serialization").unserialize;
var result=unserialize("a:1:{s:3:\"key\";s:11:\"hello world\"}");
console.log(result.key);
//hello world
var serialize=require("php-serialization").serialize;
var Class=require("php-serialization").Class;
var c=new Class("") //array
var o=new Class("MongoId") //object
o.__addAttr__("_value","string","123efa21bc123","string");
o.__addAttr__("_private_value","string","i'm private","string","private");
o.__addAttr__("_protected_value","string","i'm protected","string","protected");
c.__addAttr__("_id","string",o,"object");
console.log(serialize(c,"array"));
//a:1:{s:3:"_id";O:7:"MongoId":3:{s:6:"_value";s:13:"123efa21bc123";s:23:"MongoId_private_value";s:11:"i'm private";s:19:"*_protected_value";s:13:"i'm protected";}}
This project was originally used in manipulating sessions between Nodejs and Laravel 4. So certain code complexities were added to implement all Laravel 4 session serialization feature.
B [01]
D [0-9]
S [a-zA-Z0-9_]
K integer|string
V integer|string+|float|boolean|null|class|array|object
integer i:<D+>; //i:<value>;
float d:<D+.D+>; //d:<value>;
string s:<D+>:"<S+>"; //s:<length of string>:"<string>";
boolean b:<B>; //b:<true of false>; notice that it can only be either 1 or 0;
null n; //
class c:<D+>:"<S+>":<D+>:{<S+>} //c:<length of class name>:<class name>:<length of value>:{<value>} notice that this is a general class, it presents the serialized valye of a class (reasons are still unknown,only seen in laravel). For general meaning class,please see *Object*
array a:<D+>:{<[KV]+>} //a:<size of properties>:{<property_key><property_value>......}
object o:<D+>:"<S+>":<D+>:{<[KV]+>} //o:<length of object/class name>:"<object/class name>":<size of properties>:{<property_key><property_value>......}
resource r:<D+>; //r:<resource id>;
####serialize(obj:*,type:string);
type is the value from above format list;
####new Class(name:string);
if name is null,it means it's a normal array/object (not a class)
####Class.__has__(key:string);
####Class.__addAttr__(key:*,keyType:string,value:*,valueType:string,scope:string="public",getter:Function=default,setter:Function=default);
notice that *key* can only be integer or string;
*keyType* and *valueType* indicates the type of key/value;
*scope* can be public,protected,private ;
*getter* and *setter* are called when getting/setting this value. default setter/getter are provided,which would be simple return/set values.(eg,without typechecking,etc);
####Class.__typeOf__(key:string); ####Class.__keyTypeOf__(key:string); ####Class.__scopeOf__(key:string);
FAQs
A library used to serialize and unserialize like it was in php (especially useful for manipulating laravel sessions stored with redis server)
We found that @roblabla/php-serialization demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.