xref: /PHP-5.3/tests/classes/private_003.phpt (revision ffd6f29e)
1--TEST--
2ZE2 A private method cannot be called in a derived class
3--SKIPIF--
4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5--FILE--
6<?php
7ini_set("error_reporting",2039);
8class pass {
9	private static function show() {
10		echo "Call show()\n";
11	}
12
13	protected static function good() {
14		pass::show();
15	}
16}
17
18class fail extends pass {
19	static function ok() {
20		pass::good();
21	}
22
23	static function not_ok() {
24		pass::show();
25	}
26}
27
28fail::ok();
29fail::not_ok(); // calling a private function
30
31echo "Done\n"; // shouldn't be displayed
32?>
33--EXPECTF--
34Call show()
35
36Fatal error: Call to private method pass::show() from context 'fail' in %s on line %d
37