#22725 [Opn->Ver]: A derived class cannot call a parent's method that calls a private method

From: Date: Sun, 01 Jun 2003 18:09:47 +0000
Subject: #22725 [Opn->Ver]: A derived class cannot call a parent's method that calls a private method
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40836@lists.php.net to get a copy of this message
 ID:               22725
 Updated by:       helly@php.net
 Reported By:      sysadmin at alexdupre dot com
-Status:           Open
+Status:           Verified
 Bug Type:         Zend Engine 2 problem
 Operating System: FreeBSD 4-STABLE
 PHP Version:      5CVS-2003-03-15 (dev)


Previous Comments:
------------------------------------------------------------------------

[2003-03-15 03:54:40] sysadmin at alexdupre dot com

--TEST--
A derived class can call a parent's protected method that calls a
private method
--SKIPIF--
<?php if (version_compare(zend_version(), '2.0.0-dev', '<'))
die('skip
ZendEngine 2 needed'); ?>
--FILE--
<?php
class Foo {
    private function aPrivateMethod() {
        echo "Foo::aPrivateMethod() called.\n";
    }

    protected function aProtectedMethod() {
        echo "Foo::aProtectedMethod() called.\n";
        $this->aPrivateMethod();
    }
}

class Bar extends Foo {
    public function aPublicMethod() {
        echo "Bar::aPublicMethod() called.\n";
        $this->aProtectedMethod();
    }
}

$o = new Bar;
$o->aPublicMethod();
?>
--EXPECT--
Bar::aPublicMethod() called.
Foo::aProtectedMethod() called.
Foo::aPrivateMethod() called.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22725&edit=1



Thread (3 messages)

« previous php.bugs (#40836) next »