summaryrefslogtreecommitdiff
path: root/tests/classes/protected_001b.phpt
blob: 6f00ffc1b36d6a18cf8a93aeeb95b76e622c3025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
ZE2 A protected method can only be called inside the class
--FILE--
<?php

class pass {
	protected function fail() {
		echo "Call fail()\n";
	}

	public function good() {
		$this->fail();
	}
}

$t = new pass();
$t->good();
$t->fail();// must fail because we are calling from outside of class pass

echo "Done\n"; // shouldn't be displayed
?>
--EXPECTF--
Call fail()

Fatal error: Uncaught Error: Call to protected method pass::fail() from context '' in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d