call_user_func_array & parent

Ярослав

Новичок
call_user_func_array & parent

Здравствуйте.
Как правильно вызвать парентовый конструктор через call_user_func_array.
$args = func_get_args();
call_user_func_array(array('parent', '__construct'), $args);

Strict Standards: Non-static method Zend_Controller_Action::__construct() cannot be called statically, assuming $this from compatible context...
Спасибо
 

HraKK

Мудак
Команда форума
PHP:
<?php
class a
{
    function __construct()
    {
        print_r( func_get_args());
    }
}

class b extends a
{
    function __construct()
    {
        call_user_func_array( array( get_parent_class(), '__construct'), array(1,2));
    }
}

new b;
 

advocat

developer
HraKK
в твоем примере тоже будет ошибка
Debug Strict (PHP 5): Non-static method a::__construct() cannot be called statically, assuming $this from compatible context b

з.ы. Насколько я знаю, единственный вариант обратится к не статик методу через $this
 
Сверху