Edit report at https://bugs.php.net/bug.php?id=64286&edit=1

 ID:                 64286
 Updated by:         johan...@php.net
 Reported by:        joaner1206 at gmail dot com
 Summary:            Magic __call() not work through inheritance
-Status:             Open
+Status:             Not a bug
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   Linux 2.6
 PHP Version:        不着边际
 Block user comment: N
 Private report:     N

 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

superTest has no access to private elements from any other class.


Previous Comments:
------------------------------------------------------------------------
[2013-02-23 17:05:47] joaner1206 at gmail dot com

Description:
------------
When the magic __call() form extends,It can't call the private or protected 
function of child class, and worse, it would have been to call its own.
But I watch others magic like __set(), __get(), they will not be affected for 
work in child.

Test script:
---------------
class superTest {
        public function __call($func, $param) {
                echo "Is __call", PHP_EOL;
                $this->$func($param);
        }
}
final class test extends superTest {
        private function hello($i) {
                echo "hello,world - $i[0]", PHP_EOL;
        }
        /** It will call hello() , only once, everything is fine
        public function __call($func, $param) {
                echo "Is __call in Child", PHP_EOL;
                $this->$func($param);
        } */
}

$test = new test();
$test->hello(1);

Expected result:
----------------
Is __call
Hello,world - 1

Actual result:
--------------
Is __call
Is __call
Is __call
Is __call
Is __call
Is __call
Is __call
...
// stack exception


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



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

Reply via email to