Chris@18: Polyfill unserialize [![Build Status](https://travis-ci.org/dbrumann/polyfill-unserialize.svg?branch=master)](https://travis-ci.org/dbrumann/polyfill-unserialize) Chris@18: === Chris@18: Chris@18: Backports unserialize options introduced in PHP 7.0 to older PHP versions. Chris@18: This was originally designed as a Proof of Concept for Symfony Issue [#21090](https://github.com/symfony/symfony/pull/21090). Chris@18: Chris@18: You can use this package in projects that rely on PHP versions older than PHP 7.0. Chris@18: In case you are using PHP 7.0+ the original `unserialize()` will be used instead. Chris@18: Chris@18: From the [documentation](https://secure.php.net/manual/en/function.unserialize.php): Chris@18: Chris@18: > Warning: Do not pass untrusted user input to unserialize(). Unserialization can Chris@18: > result in code being loaded and executed due to object instantiation Chris@18: > and autoloading, and a malicious user may be able to exploit this. Chris@18: Chris@18: This warning holds true even when `allowed_classes` is used. Chris@18: Chris@18: Requirements Chris@18: ------------ Chris@18: Chris@18: - PHP 5.3+ Chris@18: Chris@18: Installation Chris@18: ------------ Chris@18: Chris@18: You can install this package via composer: Chris@18: Chris@18: ``` Chris@18: composer require brumann/polyfill-unserialize "^1.0" Chris@18: ``` Chris@18: Chris@18: Known Issues Chris@18: ------------ Chris@18: Chris@18: There is a mismatch in behavior when `allowed_classes` in `$options` is not Chris@18: of the correct type (array or boolean). PHP 7.1 will issue a warning, whereas Chris@18: PHP 7.0 will not. I opted to copy the behavior of the former. Chris@18: Chris@18: Tests Chris@18: ----- Chris@18: Chris@18: You can run the test suite using PHPUnit. It is intentionally not bundled as Chris@18: dev dependency to make sure this package has the lowest restrictions on the Chris@18: implementing system as possible. Chris@18: Chris@18: Please read the [PHPUnit Manual](https://phpunit.de/manual/current/en/installation.html) Chris@18: for information how to install it on your system. Chris@18: Chris@18: You can run the test suite as follows: Chris@18: Chris@18: ``` Chris@18: phpunit -c phpunit.xml.dist tests/ Chris@18: ``` Chris@18: Chris@18: Contributing Chris@18: ------------ Chris@18: Chris@18: This package is considered feature complete. As such I will likely not update it Chris@18: unless there are security issues. Chris@18: Chris@18: Should you find any bugs or have questions, feel free to submit an Issue or a Pull Request.