summaryrefslogtreecommitdiff
path: root/ext/reflection/tests/bug76737.phpt
blob: 716b40e76a604fe3414f1af7bb6db1734f40bd54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
Bug #76737: Unserialized reflection objects are broken, they shouldn't be serializable
--FILE--
<?php

try {
    $r = new ReflectionClass('stdClass');
    var_dump(serialize($r));
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    $s = 'C:15:"ReflectionClass":0:{}';
    var_dump(unserialize($s));
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}
try {
    $s = 'O:15:"ReflectionClass":0:{}';
    var_dump(unserialize($s));
} catch (Exception $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECTF--
Serialization of 'ReflectionClass' is not allowed
Unserialization of 'ReflectionClass' is not allowed

Warning: Erroneous data format for unserializing 'ReflectionClass' in %s on line %d

Notice: unserialize(): Error at offset 26 of 27 bytes in %s on line %d
bool(false)