Chris@18
|
1 Polyfill unserialize [](https://travis-ci.org/dbrumann/polyfill-unserialize)
|
Chris@18
|
2 ===
|
Chris@18
|
3
|
Chris@18
|
4 Backports unserialize options introduced in PHP 7.0 to older PHP versions.
|
Chris@18
|
5 This was originally designed as a Proof of Concept for Symfony Issue [#21090](https://github.com/symfony/symfony/pull/21090).
|
Chris@18
|
6
|
Chris@18
|
7 You can use this package in projects that rely on PHP versions older than PHP 7.0.
|
Chris@18
|
8 In case you are using PHP 7.0+ the original `unserialize()` will be used instead.
|
Chris@18
|
9
|
Chris@18
|
10 From the [documentation](https://secure.php.net/manual/en/function.unserialize.php):
|
Chris@18
|
11
|
Chris@18
|
12 > Warning: Do not pass untrusted user input to unserialize(). Unserialization can
|
Chris@18
|
13 > result in code being loaded and executed due to object instantiation
|
Chris@18
|
14 > and autoloading, and a malicious user may be able to exploit this.
|
Chris@18
|
15
|
Chris@18
|
16 This warning holds true even when `allowed_classes` is used.
|
Chris@18
|
17
|
Chris@18
|
18 Requirements
|
Chris@18
|
19 ------------
|
Chris@18
|
20
|
Chris@18
|
21 - PHP 5.3+
|
Chris@18
|
22
|
Chris@18
|
23 Installation
|
Chris@18
|
24 ------------
|
Chris@18
|
25
|
Chris@18
|
26 You can install this package via composer:
|
Chris@18
|
27
|
Chris@18
|
28 ```
|
Chris@18
|
29 composer require brumann/polyfill-unserialize "^1.0"
|
Chris@18
|
30 ```
|
Chris@18
|
31
|
Chris@18
|
32 Known Issues
|
Chris@18
|
33 ------------
|
Chris@18
|
34
|
Chris@18
|
35 There is a mismatch in behavior when `allowed_classes` in `$options` is not
|
Chris@18
|
36 of the correct type (array or boolean). PHP 7.1 will issue a warning, whereas
|
Chris@18
|
37 PHP 7.0 will not. I opted to copy the behavior of the former.
|
Chris@18
|
38
|
Chris@18
|
39 Tests
|
Chris@18
|
40 -----
|
Chris@18
|
41
|
Chris@18
|
42 You can run the test suite using PHPUnit. It is intentionally not bundled as
|
Chris@18
|
43 dev dependency to make sure this package has the lowest restrictions on the
|
Chris@18
|
44 implementing system as possible.
|
Chris@18
|
45
|
Chris@18
|
46 Please read the [PHPUnit Manual](https://phpunit.de/manual/current/en/installation.html)
|
Chris@18
|
47 for information how to install it on your system.
|
Chris@18
|
48
|
Chris@18
|
49 You can run the test suite as follows:
|
Chris@18
|
50
|
Chris@18
|
51 ```
|
Chris@18
|
52 phpunit -c phpunit.xml.dist tests/
|
Chris@18
|
53 ```
|
Chris@18
|
54
|
Chris@18
|
55 Contributing
|
Chris@18
|
56 ------------
|
Chris@18
|
57
|
Chris@18
|
58 This package is considered feature complete. As such I will likely not update it
|
Chris@18
|
59 unless there are security issues.
|
Chris@18
|
60
|
Chris@18
|
61 Should you find any bugs or have questions, feel free to submit an Issue or a Pull Request.
|