Zend Amazon S3 conflicting with Twitter

I’ve recently been working on the backend for a project which revealed a conflict between Zend_Service_Amazon_S3 and Zend_Service_Twitter.

The issue caused pushing content to Zend_Service_Amazon_S3 to fail with 401 errors if the call was made after a call to post a twitter status update with Zend_Service_Twitter.  It appeared to be because both of these extend Zend_Service_Abstract which shares an instance of Zend_Http_Client.

Work-a-round:

Around line 409 of Zend/Service/Amazon/S3.php there is a line which gets the current instance of Zend_Http_Client:

$client = self::getHttpClient();

Changing this line to:

$client = new Zend_Http_Client();

Fixes the problem.  I’m sure there is probably a more graceful workaround for this problem; but this one certainly fixes the conflict between these two services.

You can leave a response, or trackback from your own site.

Leave a Reply