Issues

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

Description

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():


            // 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:

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'.

Comments

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

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()....)

Hey guys ... sorry for the delay.

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

thanks, -L

Set component and change assinee

Set Fix Version. may be SVN r17812.