Symfony在__call()方法中调用call_user_func_array()后关闭

时间:2016-02-09 14:06:42

标签: php symfony callback magic-methods

我有两个简单的类

Parent

class Parent {
    public function __call($name, $args)
    {
        return call_user_func_array([$this, $name], $args);
    }
}

Child

class Child extends Parent {
    private function test()
    {
        return 1;
    }
}

当我执行Child对象$child->test()时,我的Symfony服务器(由php bin/console server:run运行)发生故障。只有消息为[ERROR] Built-in server terminated unexpectedly.

1 个答案:

答案 0 :(得分:2)

方法Parent是私有的,无法从protected范围执行。制作方法{{1}}。