#33806 [Opn->Bgs]: Access to protected functions from static function in base class
| From: | tony2001@php.net | Date: | Thu, 21 Jul 2005 13:32:59 +0000 |
| Subject: | #33806 [Opn->Bgs]: Access to protected functions from static function in base class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82284@lists.php.net to get a copy of this message | ||
ID: 33806
Updated by: tony2001@php.net
Reported By: pascal dot parietti at fh-aargau dot ch
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Linux, 2.6.11
PHP Version: 5.0.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2005-07-21 15:25:31] pascal dot parietti at fh-aargau dot ch
Description:
------------
A static function in the base class (A) can execute a protected
function in a derived class (B).
If the same function is called from outside of class A the PHP Fatal
error occurs as excepted.
The error also occurs with the CVS Snapshot php5-STABLE-200507211237
compiled with ./configure && make
Reproduce code:
---------------
<?php
class A {
public static function test() {
$a = new B();
$a->test2(); # why does this work?
}
}
class B extends A {
protected function test2() {
echo "B: test2 \n";
}
}
A::test();
$b = new B();
# call a protected function -> PHP Fatal error as excepted:
$b->test2();
?>
Expected result:
----------------
PHP Fatal error: Call to protected method B::test2() on line 5
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33806&edit=1