I have been using this syntax for a while now because I thought there was some sort of advantage:
if ($form->isValid($this->_request->getPost()))
…but is there really any advantage to calling getPost() versus simply calling $_POST:
if ($form->isValid($_POST))
No, it does exactly the same. you can open up
Zend_Controller_Request_Httpand review the getPost() function yourself. it’s returning $_POST without filtering.Personally, I like to use Zend framework functions rather than global variables, because if something will get changed in the PHP language, the zend framework developers will take care of the changes.
For example, the POST variable was deprecated at some point (
$HTTP_POST_VARS) and renamed to$_POST. so using the zend framework function might be a little safer for future PHP updates..