Skip to content

PHP object that will take a serialised object and parse it, ignoring the sizes specified. This is useful when serialized objects are corrupted and need fixing

License

jedi58/reserializer

Repository files navigation

Reserializer

Build Status StyleCI Code Climate Coverage Status

PHP class that will take a serialised object and parse it, ignoring the sizes specified. This is useful when serialized objects are corrupted and need fixing

Usage

Reserializer::parse('s:21:"https://www.google.com";');

The above example contains an invalid serialized object as the string is one character longer than it should be. The parse function will take this, ignore the suggested length and will return the string ready to be reserialised. Alternatively, the class can do the whole process itself:

Reserializer::reserialize('s:21:"https://www.google.com";')

The expected output for this is s:22:"https://www.google.com";. It is possible to use this for more complicated examples of type bool, int, string, array, and objects. In the case of objects they will however be converted into stdClass.

Testing

There are a number of unit tests which can be executed by running the following from your checkout

$  phpunit

About

PHP object that will take a serialised object and parse it, ignoring the sizes specified. This is useful when serialized objects are corrupted and need fixing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages