ID:               49328
 User updated by:  rayro at gmx dot de
 Reported By:      rayro at gmx dot de
 Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Windows XP
 PHP Version:      5.3.0
 New Comment:

Well, does Foo::__call has access to Bar::test() if the private
function is defined in the abstract class?
Although, since 5.3 __call can handle private functions (place __call
in Bar), this _should_ be argumented as a bug i think?
The access level should not matter while extending?


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

[2009-08-22 13:26:39] col...@php.net

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Foo::__call() doesn't have access to Bar::test() since its private. I
can't see see the "problem" here.

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

[2009-08-22 12:25:18] rayro at gmx dot de

Description:
------------
While public functions will be called on the extended class, private
will not. If you define a "test" function in the Foo class, the function
on the extended class will be called like expected. Code is
self-explaining this "problem"...

Reproduce code:
---------------
abstract class Foo {
        function __call($f, $a) {
                return call_user_func_array(array($this, $f), $a);
        }
        // uncomment this: private function test() { }
}
class Bar extends Foo {
        private function test($a) {
                var_dump($a);
        }
}
$bar = new Bar();
$bar->test('hello');

Expected result:
----------------
string(5) "hello"

Actual result:
--------------
endless loop


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


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

Reply via email to