xref: /PHP-8.4/ext/reflection/tests/bug76737.phpt (revision 570d9b63)
1--TEST--
2Bug #76737: Unserialized reflection objects are broken, they shouldn't be serializable
3--FILE--
4<?php
5
6try {
7    $r = new ReflectionClass('stdClass');
8    var_dump(serialize($r));
9} catch (Exception $e) {
10    echo $e->getMessage(), "\n";
11}
12try {
13    $s = 'C:15:"ReflectionClass":0:{}';
14    var_dump(unserialize($s));
15} catch (Exception $e) {
16    echo $e->getMessage(), "\n";
17}
18try {
19    $s = 'O:15:"ReflectionClass":0:{}';
20    var_dump(unserialize($s));
21} catch (Exception $e) {
22    echo $e->getMessage(), "\n";
23}
24?>
25--EXPECTF--
26Serialization of 'ReflectionClass' is not allowed
27Unserialization of 'ReflectionClass' is not allowed
28Unserialization of 'ReflectionClass' is not allowed
29