mirror of
https://github.com/php/php-src.git
synced 2024-09-30 22:36:12 +00:00
31 lines
625 B
PHP
31 lines
625 B
PHP
--TEST--
|
|
ZE2 A protected method can only be called inside the class
|
|
--SKIPIF--
|
|
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
|
--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
|