ZF-7437: Zend_Rest_Route defaulting to a non-existent 'listAction'

Issue Type: Bug Created: 2009-07-31T21:41:17.000+0000 Last Updated: 2009-08-25T22:30:04.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: David Abdemoulaie (hobodave) Assignee: Luke Crouch (lcrouch) Tags: - Zend_Rest_Route

Related issues: - ZF-7598

Attachments: - ZF-7437.patch


When extending Zend_Rest_Controller you are required to define the index, get, post, put, and delete actions.

Yet Zend_Rest_Route attempts to call the non-existent 'listAction' in the following block of code in match():

<pre class="highlight">
            // Check for leading "special get" URI's 
            $specialGetTarget = false;
            if ($pathElementCount && array_search($path[0], array('index', 'new')) > -1) { 
                $specialGetTarget = array_shift($path);
            } elseif ($pathElementCount == 1) {
                 $params['id'] = array_shift($path);
            } elseif ($pathElementCount == 0 || $pathElementCount > 1) {
                $specialGetTarget = 'list';

This results in the following exception and trace:

<pre class="literal">
Exception information:

Message: Action "list" does not exist and was not trapped in __call()
Stack trace:

#0 /Users/hobodave/dev/php/blog/library/Zend/Controller/Action.php(515): Zend_Controller_Action->__call('listAction', Array)
#1 /Users/hobodave/dev/php/blog/library/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('listAction')

The documentation doesn't mention any 'listAction', which leads me to believe the correct solution is to change 'list' to 'index'.


Posted by David Abdemoulaie (hobodave) on 2009-07-31T22:06:31.000+0000

Attached patch creating a new unit test to cover this, as well as the fix.

Posted by Holger Schäfer (hschaefer123) on 2009-08-14T05:23:34.000+0000

I'm using rest services implementing Zend_Rest_Controller as action controller. The service interface lacks the used listAction. Fixing this problems maybe needs also changes in the service interface (listAction()....)

Posted by Luke Crouch (groovecoder) on 2009-08-19T06:47:14.000+0000

Hey guys ... sorry for the delay.

I'll get started on this and the other Zend_Rest bugs ASAP.

thanks, -L

Posted by Satoru Yoshida (satoruyoshida) on 2009-08-21T19:04:45.000+0000

Set component and change assinee

Posted by Satoru Yoshida (satoruyoshida) on 2009-08-25T22:30:04.000+0000

Set Fix Version. may be SVN r17812.

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.