2003-02-06 07:07:24 +08:00
|
|
|
--TEST--
|
2003-08-09 22:48:47 +08:00
|
|
|
ZE2 A protected method can only be called inside the class
|
2003-02-06 07:07:24 +08:00
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
|
|
|
|
class pass {
|
2020-02-04 05:52:20 +08:00
|
|
|
protected function fail() {
|
|
|
|
echo "Call fail()\n";
|
|
|
|
}
|
2003-02-06 07:07:24 +08:00
|
|
|
|
2020-02-04 05:52:20 +08:00
|
|
|
public function good() {
|
|
|
|
$this->fail();
|
|
|
|
}
|
2003-02-06 07:07:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$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()
|
|
|
|
|
2020-05-26 20:10:57 +08:00
|
|
|
Fatal error: Uncaught Error: Call to protected method pass::fail() from global scope in %s:%d
|
2015-05-16 03:04:07 +08:00
|
|
|
Stack trace:
|
|
|
|
#0 {main}
|
|
|
|
thrown in %s on line %d
|