ZF-3705: Zend_Rest_Client_Result does not check if its operating on an object instance
Description
One of the reasons to use the rest client is to get convenient overloading behavior. However if the expected structure of the result does not match, then I can end up with a fatal error unless I manually check.
For example: $pricesList = new Zend_Rest_Client($url); $result = $pricesList->get(); $result->pricesxmlexport->pricesgroup->price
I can easily end up with a fatal error here if the document does not match my expectations. This is due to the fact that the __get() method in Zend_Rest_Client_Result does not check if it can even call the xpath() method in $this->_sxml before calling it.
Comments
Posted by Martin Panel (xorax) on 2008-07-24T08:56:44.000+0000
a new class may be created to fix it :
Zend/Rest/Client/Result/Exception.php :
class Zend_Rest_Client_Result_Exception extends Zend_Rest_Client_Exception {}
and after line 43 of Zend/Rest/Client/Result.php:
add :
Posted by Dave Hall (skwashd) on 2008-07-25T16:25:59.000+0000
This looks like it is related to ZF-3647 and the fix is very similar
Posted by Benjamin Eberlei (beberlei) on 2008-11-07T04:28:22.000+0000
Fixed in trunk. Implementation is using a simple error handler for the Xml parsing to show a specific error message.
Posted by Wil Sinclair (wil) on 2008-11-13T14:09:56.000+0000
Changing issues in preparation for the 1.7.0 release.