-
Notifications
You must be signed in to change notification settings - Fork 18
Unserialize whitelist #37
Unserialize whitelist #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Else - from my perspective it looks quite good 👍
src/Adapter/PhpSerialize.php
Outdated
| /** | ||
| * Set options | ||
| * | ||
| * @param array|\Traversable|PhpSerializeOptions $options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please import Traversable
src/Adapter/PhpSerializeOptions.php
Outdated
| * Zend Framework (http://framework.zend.com/) | ||
| * | ||
| * @link http://github.com/zendframework/zf2 for the canonical source repository | ||
| * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2015?
test/Adapter/PhpSerializeTest.php
Outdated
| { | ||
| $value = 'O:8:"stdClass":0:{}'; | ||
|
|
||
| $this->adapter->getOptions()->setUnserializeClassWhitelist(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail on PHP < 7
test/Adapter/PhpSerializeTest.php
Outdated
| { | ||
| $value = 'O:8:"stdClass":0:{}'; | ||
|
|
||
| $this->adapter->getOptions()->setUnserializeClassWhitelist([\My\Dummy::class]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail on PHP < 7
test/Adapter/PhpSerializeTest.php
Outdated
| { | ||
| $value = 'O:8:"stdClass":0:{}'; | ||
|
|
||
| $this->adapter->getOptions()->setUnserializeClassWhitelist([\stdClass::class]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail on PHP < 7
src/Adapter/PhpSerializeOptions.php
Outdated
| protected $unserializeClassWhitelist = true; | ||
|
|
||
| /** | ||
| * @param array|bool $unserializeClassWhitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@param string[]|bool $unserializeClassWhitelist
src/Adapter/PhpSerializeOptions.php
Outdated
| } | ||
|
|
||
| /** | ||
| * @return array|bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@return string[]|bool
…list Unserialize whitelist
- Updates license docblocks of changed files to reflect current standards. - Use a ternary to get the return value of the `unserialize()` operation (simpler to read than if/else block). - No fluent operations in new classes. - Review all docblocks for formatting, grammar. - Use annotations to require PHP 7 for tests - split out a single test to demonstrate expected behavior in versions prior to 7.0
|
Thanks, @MatthiasKuehneEllerhold! |
See #36