Hi, i use the Code
// Process non-standard Content-Types
$rawBody = $request->getRawBody();
if (!empty($rawBody)) {
if (false !== ($contentType =
$request->getHeader('Content-Type'))) {
if (strstr($contentType, 'application/xml') ||
strstr($contentType, 'text/xml')) {
require_once 'Zend/Config/Xml.php';
$config = new Zend_Config_Xml($rawBody);
$request->setPost($config->toArray());
} elseif (strstr($contentType, 'application/json')) {
require_once 'Zend/Json.php';
$request->setPost(Zend_Json::decode($rawBody));
}
}
}
in a Controller plugin which handles different formats of POST data
Why it is not allowed that one value is NULL? This is the JSON data:
{
"account_id":"9119",
"ikz":"123456789",
"account":"[email protected]",
"email":"[email protected]",
"anrede":"Frau",
"vorname":"Daniela",
"nachname":"Musterfrau",
"ka_vorwahl":"0016480698",
"ka_telefon":"5496",
"ka_fax":"6546",
"gesperrt":"0",
"angelegt_von":"admin",
"angelegt_am":"2009-09-29T00:00:00",
"update_passwd":"2011-07-15T00:00:00",
"notice_passwd":null,
"bearbeitet_von":"admin",
"bearbeitet_am":"2009-09-29T00:00:00"
}
I get an exception:
Zend_Controller_Exception: (0) Invalid value passed to setPost(); must be
either array of values or key/value pair
which is clear when i look at the code of Zend_Controller_Request_Http
But why?
Is there a reason, why it is not nice to have NULL values in the POST data?
Greetings
Chris