Why does the error “expected to be a reference, value given” appear?

后端 未结 5 1335
天命终不由人
天命终不由人 2021-01-17 07:06

It fires out when I try to call function with argument by reference

function test(&$a) ...

through

call_user_func(\'tes         


        
5条回答
  •  温柔的废话
    2021-01-17 08:09

    I've just had the same problem, changing (in my case):

    $result = call_user_func($this->_eventHandler[$handlerName][$i], $this, $event);
    

    to

    $result = call_user_func($this->_eventHandler[$handlerName][$i], &$this, &$event);
    

    seem to work just fine in php 5.3.

    It's not even a workaround I think, it's just doing what is told :-)

提交回复
热议问题