php-serialize icon indicating copy to clipboard operation
php-serialize copied to clipboard

Basic handling of recursions

Open michaelfeinbier opened this issue 4 years ago • 0 comments

When PHP serializes objects it detects recursions and marks them accordingly in the serialization (tokens r and R for recursion by reference) the references objects get an integer-based number to identify them later during the deserialization.

Example

O:8:"stdClass":1:{s:8:"subClass";R:1;}

This PR adds very basic support for those recursions. It is able to unserialize strings containing these recursions and will not throw an exception. During the unserialization it acts similar to PHP's print_r() / var_dump() functions and will return a string like *RECURSION* reference #1 in the specific field.

michaelfeinbier avatar Mar 09 '21 18:03 michaelfeinbier