This has less to do with security than it has to do with ZF's design. Like you said, the methods are not accessible when invoked through a URL, but that is solely due to how Zend Framework processes requests.
Quoting the reference guide:
The workflow of Zend_Controller
is relatively simple. A request is received by Zend_Controller_Front
, which in turn calls Zend_Controller_Router_Rewrite
to determine which controller (and action in that controller) to dispatch.
Zend_Controller_Router_Rewrite
decomposes the URI in order to set the controller and action names in the request. Zend_Controller_Front
then enters a dispatch loop. It calls Zend_Controller_Dispatcher_Standard
, passing it the request, to dispatch to the controller and action specified in the request (or use defaults).
The method names get formatted in Zend_Controller_Dispatcher_Abstract
:
/**
* Formats a string into an action name. This is used to take a raw
* action name, such as one that would be stored inside a Zend_Controller_Request_Abstract
* object, and reformat into a proper method name that would be found
* inside a class extending Zend_Controller_Action.
*
* @param string $unformatted
* @return string
*/
public function formatActionName($unformatted)
{
$formatted = $this->_formatName($unformatted, true);
return strtolower(substr($formatted, 0, 1)) . substr($formatted, 1) . 'Action';
}
The Action suffix is hardcoded, so the Dispatcher will always look for an Action method, no matter what. So when you request /user/show/
, the you'd call UserController::showAction()
because of how the request is handled. It's not a security feature though or a replacement for Visibility. Make showAction()
protected and you no longer have access to it through a URL either. And technically, you could very much call the non-action methods from a URI if you don't run them through the regular setup either. You could create your own Dispatcher and change how ZF formats action names easily.
What's nice about the Action Suffix, is it makes the action methods clearly distinguishable from other methods in the controller.