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.…
Comments
Posted by Darby Felton (darby) on 2007-06-07T09:01:33.000+0000
Updated affected component.
Posted by Bill Karwin (bkarwin) on 2007-06-07T11:22:05.000+0000
Assigning to Matthew.
Posted by Matthew Weier O'Phinney (matthew) on 2007-06-22T10:39:55.000+0000
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.
Posted by Matthew Weier O'Phinney (matthew) on 2007-11-16T14:55:12.000+0000
Another report in ZF-1866. I will attempt to fix this for 1.1.0
Posted by Alexander Veremyev (alexander) on 2008-06-17T09:25:18.000+0000
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.
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:40.000+0000
Updating for the 1.6.0 release.