Issues

ZF-1499: Zend_Server_Reflection - func_get_args() and incorrect phpdoc handling

Description

h4. Overview There seems to be a problem that I've found when brought up by someone on [#zftalk | irc://irc.freenode.net/zftalk]. It seems that Zend_Server_Reflection has problems with the use of func_get_args() when there is an @param phpdoc statement with extra params.

h4. Example


/**
* Internally redirects one action to another
*
* @param string $action The new action to be redirected to
* @param mixed Any other parameters passed to this method will be passed as
* parameters to the new action.
* @access public
*/
function setAction($action)  {
    $this->action = $action;
    $args = func_get_args();
    unset($args[0]);
    call_user_func_array(array(&$this, $action), $args);
}

h4. Result Error msg: ( ! ) Fatal error: Call to a member function isOptional() on a non-object in Zend/Server/Reflection/Function/Abstract.php on line 346

h4. Discussion links http://nabble.com/Zend_Server_Reflection-t3822461.…


http://www.spotsec.com

Comments

Updated affected component.

Assigning to Matthew.

It's typically not a good plan when creating web services to allow dynamic numbers of arguments, and I'd argue that instead of allowing an undetermined number of arguments, you should have a second array argument (defaulting to an empty array).

I'll look into this, but it represents a potential BC break. Currently, each parameter is a ReflectionParameter, whereas the fix for this would require either a different object type or array as a possibility.

Another report in ZF-1866. I will attempt to fix this for 1.1.0

Fixed.

Exception is thrown now if number of arguments doesn't correspond number of actual function arguments.

That should be the best solution for services.

Updating for the 1.6.0 release.