xref: /PHP-8.2/tests/classes/abstract.phpt (revision f8d79582)
1--TEST--
2ZE2 An abstract method may not be called
3--FILE--
4<?php
5
6abstract class fail {
7    abstract function show();
8}
9
10class pass extends fail {
11    function show() {
12        echo "Call to function show()\n";
13    }
14    function error() {
15        parent::show();
16    }
17}
18
19$t = new pass();
20$t->show();
21$t->error();
22
23echo "Done\n"; // shouldn't be displayed
24?>
25--EXPECTF--
26Call to function show()
27
28Fatal error: Uncaught Error: Cannot call abstract method fail::show() in %s:%d
29Stack trace:
30#0 %s(%d): pass->error()
31#1 {main}
32  thrown in %s on line %d
33