mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Check private redeclare behavior
This commit is contained in:
parent
3f0d60f749
commit
2044fbf59e
1 changed files with 38 additions and 0 deletions
38
tests/classes/private_redeclare.phpt
Executable file
38
tests/classes/private_redeclare.phpt
Executable file
|
@ -0,0 +1,38 @@
|
|||
--TEST--
|
||||
ZE2 A derived class does not know anything about inherited private methods
|
||||
--FILE--
|
||||
<?php
|
||||
class base {
|
||||
private function show() {
|
||||
echo "base\n";
|
||||
}
|
||||
function test() {
|
||||
$this->show();
|
||||
}
|
||||
}
|
||||
|
||||
$t = new base();
|
||||
$t->test();
|
||||
|
||||
class derived extends base {
|
||||
function show() {
|
||||
echo "derived\n";
|
||||
}
|
||||
function test() {
|
||||
echo "test\n";
|
||||
$this->show();
|
||||
parent::test();
|
||||
parent::show();
|
||||
}
|
||||
}
|
||||
|
||||
$t = new derived();
|
||||
$t->test();
|
||||
?>
|
||||
--EXPECTF--
|
||||
base
|
||||
test
|
||||
derived
|
||||
base
|
||||
|
||||
Fatal error: Call to private method base::show() from context 'derived' in %s on line %d
|
Loading…
Add table
Add a link
Reference in a new issue