xref: /PHP-7.1/tests/classes/class_abstract.phpt (revision e97d5fab)
1--TEST--
2ZE2 An abstract class cannot be instanciated
3--SKIPIF--
4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5--FILE--
6<?php
7
8abstract class base {
9	function show() {
10		echo "base\n";
11	}
12}
13
14class derived extends base {
15}
16
17$t = new derived();
18$t->show();
19
20$t = new base();
21$t->show();
22
23echo "Done\n"; // shouldn't be displayed
24?>
25--EXPECTF--
26base
27
28Fatal error: Uncaught Error: Cannot instantiate abstract class base in %s:%d
29Stack trace:
30#0 {main}
31  thrown in %s on line %d
32