xref: /PHP-8.0/Zend/tests/bug73288.phpt (revision f8d79582)
1--TEST--
2Bug #73288 (Segfault in __clone > Exception.toString > __get)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--FILE--
7<?php
8
9class NoClone {
10    public function __clone() {
11        throw new Exception("No Cloneable");
12    }
13}
14
15class C {
16    public function __get($name) {
17        return new NoClone;
18    }
19}
20
21function test_clone() {
22    $c = new C;
23    $b = clone $c->x;
24}
25
26test_clone();
27?>
28--EXPECTF--
29Fatal error: Uncaught Exception: No Cloneable in %sbug73288.php:%d
30Stack trace:
31#0 %s(%d): NoClone->__clone()
32#1 %s(%d): test_clone()
33#2 {main}
34  thrown in %sbug73288.php on line %d
35