xref: /PHP-8.1/tests/lang/bug26866.phpt (revision f8d79582)
1--TEST--
2Bug #26866 (segfault when exception raised in __get)
3--FILE--
4<?php
5class bar {
6    function get_name() {
7        return 'bar';
8    }
9}
10class foo {
11    function __get($sName) {
12        throw new Exception('Exception!');
13        return new bar();
14    }
15}
16$foo = new foo();
17try {
18    echo $foo->bar->get_name();
19}
20catch (Exception $E) {
21    echo "Exception raised!\n";
22}
23?>
24--EXPECT--
25Exception raised!
26