xref: /PHP-5.4/Zend/tests/bug22725.phpt (revision 610c7fbe)
1--TEST--
2Bug #22725 (A derived class can call a parent's protected method that calls a private method)
3--SKIPIF--
4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5--FILE--
6<?php
7class Foo {
8    private function aPrivateMethod() {
9        echo "Foo::aPrivateMethod() called.\n";
10    }
11
12    protected function aProtectedMethod() {
13        echo "Foo::aProtectedMethod() called.\n";
14        $this->aPrivateMethod();
15    }
16}
17
18class Bar extends Foo {
19    public function aPublicMethod() {
20        echo "Bar::aPublicMethod() called.\n";
21        $this->aProtectedMethod();
22    }
23}
24
25$o = new Bar;
26$o->aPublicMethod();
27?>
28--EXPECT--
29Bar::aPublicMethod() called.
30Foo::aProtectedMethod() called.
31Foo::aPrivateMethod() called.
32