Zend Framework - Send does not contain data to send

My problem seems similar. When I submit the form, its POST data and related issues are not displayed , but the proposed solutions do not apply to my project, so I currently do not use redirects.

I am trying to learn the Zend Framework. In the current project I'm working on, there was a problem when the superglobal variables $ _POST and $ _GET passed from my form are returned empty. I worked to simplify the problem, to determine where it was caused, but it looks like I ran into a brick wall. It seems that no POST data is sent at all ...

My view:

<form method="post" action="/character/addsubmit"> <input type=hidden name='test' id='test' value='test'> <input type='submit'> </form> 

My controller:

 <?php class CharacterController extends Zend_Controller_Action { public function addsubmitAction() { Zend_Debug::dump($this->getRequest()); echo "<br/>\$_POST: <br/>"; print_r($_POST); echo "<br/>\$_GET: <br/>"; print_r($_GET); echo "<br/><br/>"; if($this->_request->isPost()) { echo "\$_POST Found<br/>"; } else { echo "\$_POST Not Found <br/>"; } if ($this->_request->isGet()) { echo "\$_GET Found<br/>"; } else { echo "\$_GET Not Found<br/>"; } } } ?> 

Going to the form, then submitting (by clicking the submit button), I get the following output:

 object(Zend_Controller_Request_Http)#8 (15) { ["_paramSources:protected"] => array(2) { [0] => string(4) "_GET" [1] => string(5) "_POST" } ["_requestUri:protected"] => string(20) "/character/addsubmit" ["_baseUrl:protected"] => string(0) "" ["_basePath:protected"] => NULL ["_pathInfo:protected"] => string(20) "/character/addsubmit" ["_params:protected"] => array(3) { ["controller"] => string(9) "character" ["action"] => string(9) "addsubmit" ["module"] => string(7) "default" } ["_rawBody:protected"] => NULL ["_aliases:protected"] => array(0) { } ["_dispatched:protected"] => bool(true) ["_module:protected"] => string(7) "default" ["_moduleKey:protected"] => string(6) "module" ["_controller:protected"] => string(9) "character" ["_controllerKey:protected"] => string(10) "controller" ["_action:protected"] => string(9) "addsubmit" ["_actionKey:protected"] => string(6) "action" } $_POST: Array ( ) $_GET: Array ( ) $_POST Not Found $_GET Found 

The only thing that really throws me into the loop is that the isGet function returns true.

Does anyone with more knowledge of Zend have an idea of ​​why I have so many problems submitting forms using this structure? Is there some kind of configuration that I might have missed or possibly set incorrectly that could cause this?

Note. I use Zend_Form for the actual application, as well as for using most of the framework itself, but I bounced back trying to debug this problem. If you need more information about my configuration, I can provide it.

Thanks!

Edit:

The contents of my .htaccess:

[I deleted these lines because it was the wrong file, I'm still looking for the right one.]

+4
source share
2 answers

This thread is old, but the following tip may help other readers. I just experienced this problem and found a solution here:

https://serverfault.com/questions/127674/mysteriously-empty-post-array

I just installed the local LAMP development environment and, filling my database with phpMyAdmin, changed the post_max_size php.ini directive to allow loading a large SQL dump. Unfortunately, I made a mistake of 1G as 1GB in the INI file. PHP interpreted this as a 1-byte limit, which, of course, all my POST messages exceed, so they come as empty arrays.

Check the server error log for something similar to the following:

 [Sat Oct 01 17:08:07 2011] [error] [client 127.0.0.1] PHP Warning: Unknown: POST Content-Length of 63 bytes exceeds the limit of 1 bytes in Unknown on line 0, referer: http://localhost/[...] 
+2
source

You tried

 $this->_request->getParams(); 
0
source

All Articles