/hphp/test/zend/bad/ext/spl/tests/unserialize.php
PHP | 18 lines | 12 code | 2 blank | 4 comment | 0 complexity | 63d6681d3a57a6f184844554b338db04 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?php
- $types = array('SplDoublyLinkedList', 'SplObjectStorage', 'ArrayObject');
- foreach ($types as $type) {
- // serialize an empty new object
- $exp = serialize(new $type());
- // hack to instanciate an object without constructor
- $str = sprintf('C:%d:"%s":0:{}', strlen($type), $type);
- $obj = unserialize($str);
- var_dump($obj);
- // serialize result
- $out = serialize($obj);
- // both should match
- var_dump($exp === $out);
- }
- ?>
- ===DONE===