ZF-200: Zend_Service_Rest restPost doesn't set argument 2 for _prepareRest() and causes fatal error.
Description
There's a bug in the Zend_Service_Rest restPost method, it doesn't set the 2nd argument for the Zend_Service_Rest _prepareRest method. This is what the original code looks like:
final public function restPost($path, $data)
{
$this->_prepareRest($path);
$this->_uri->queryArray($data);
return self::getHttpClient()->post($data);
}
$this->_prepareRest($path) should actually be $this->_prepareRest($path,$data);
In the same piece of code the $this->_uri->queryArray() call causes a fatal error, because Zend_Uri_Http doesn't have such a method. It must be called with setQueryArray() and the return value should be capture in $data. Here's the correct code:
final public function restPost($path, $data)
{
$this->_prepareRest($path);
$data = this->_uri->setQueryArray($data);
return self::getHttpClient()->post($data);
}
The same situation also applies for the restPut() method!!
Comments
Posted by Bill Karwin (bkarwin) on 2006-11-13T15:19:04.000+0000
Changing fix version to unknown.
Posted by Matthew Weier O'Phinney (matthew) on 2007-02-14T14:26:21.000+0000
Resolved in current trunk