xref: /PHP-8.2/Zend/tests/exception_004.phpt (revision f8d79582)
1--TEST--
2Throwing exception using a class that isn't derived from the Exception base class
3--FILE--
4<?php
5
6class Foo { }
7
8try {
9    throw new Foo();
10} catch (Foo $e) {
11    var_dump($e);
12}
13
14?>
15--EXPECTF--
16Fatal error: Uncaught Error: Cannot throw objects that do not implement Throwable in %s:%d
17Stack trace:
18#0 {main}
19  thrown in %s on line %d
20