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

Issue Type: Bug Created: 2007-06-05T17:32:26.000+0000 Last Updated: 2008-09-02T10:39:40.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Geoffrey Tran (potatobob) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Server_Reflection

Related issues: - ZF-1866



h4. Overview There seems to be a problem that I've found when brought up by someone on [#zftalk | irc://]. 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

<pre class="highlight">
* 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();
    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…


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


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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.