common
common copied to clipboard
DCOM-282: Use call_user_func_array in proxy classes
Jira issue originally created by user jacksleight:
At the moment the proxy generator creates methods like this:
public function type()
{
$this->*_initializer__ && $this->__initializer__->_*invoke($this, 'type', array());
return parent::type();
}
However, this breaks methods in the entity class that rely on func*num_args or func_get*args (eg. a method that can have variable arguments), as only the defined arguments are passed through to the parent method.
I would like to suggest changing the proxy generator to output code like this:
public function type()
{
$this->*_initializer__ && $this->__initializer__->_*invoke($this, 'type', array());
$args = func*get*args();
return call*user_func*array('parent::type', $args);
}
So that all arguments are passed through.
I'd be happy to create a pull request for this, unless there's a reason why you wouldn't want to do it that way?
Comment created by @ocramius:
This is indeed a known issue, and it wasn't fixed due to performance reasons.
You may want to check https://github.com/doctrine/doctrine2/pull/1241, which also fixes this issue.