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