xref: /PHP-8.2/Zend/tests/bug69761.phpt (revision c83cbdf6)
1--TEST--
2Bug #69761 (Serialization of anonymous classes should be prevented)
3--FILE--
4<?php
5$instance = new class('foo') {
6    public function __construct($i) {
7    }
8};
9var_dump(serialize($instance));
10?>
11--EXPECTF--
12Fatal error: Uncaught Exception: Serialization of 'class@%s' is not allowed in %sbug69761.php:%d
13Stack trace:
14#0 %sbug69761.php(%d): serialize(Object(class@anonymous))
15#1 {main}
16  thrown in %sbug69761.php on line %d
17