xref: /PHP-7.3/tests/classes/private_005.phpt (revision a8d901a8)
1--TEST--
2ZE2 A private method cannot be called in a derived class
3--FILE--
4<?php
5
6class pass {
7	private static function show() {
8		echo "Call show()\n";
9	}
10
11	public static function do_show() {
12		pass::show();
13	}
14}
15
16class fail extends pass {
17	static function do_show() {
18		pass::show();
19	}
20}
21
22pass::do_show();
23fail::do_show();
24
25echo "Done\n"; // shouldn't be displayed
26?>
27--EXPECTF--
28Call show()
29
30Fatal error: Uncaught Error: Call to private method pass::show() from context 'fail' in %s:%d
31Stack trace:
32#0 %s(%d): fail::do_show()
33#1 {main}
34  thrown in %s on line %d
35