ZF-7990: URL endpoint setting is done AFTER authentification, it makes problems


In Zend_Service_Amazon_S3 there is a small defect. You set endpoint after you do the authentication.

I attached the patch that fixes the problem.

--- .../library/Zend/Service/Amazon/S3.php  (revision 18447)
+++ .../library/Zend/Service/Amazon/S3.php  (working copy)
@@ -474,6 +474,7 @@
         $client = self::getHttpClient();
+        $client->setUri($endpoint);
         // Work around buglet in HTTP client - it doesn't clean headers
         // Remove when ZHC is fixed
@@ -482,7 +483,6 @@
                                   'Range'       => null,
                                   'x-amz-acl'   => null));
-        $client->setUri($endpoint);


This patch fixes the problem

Fatal error: Call to a member function setUsername() on a non-object in /code/ilks/php/src/library/Zend/Http/Client.php on line 545

This is what I get

this is a workaround I have to use for now:

    $s3 = new Zend_Service_Amazon_S3($key, $secret);    
    Zend_Service_Amazon_S3::getHttpClient()->setUri('<a rel="nofollow" href=""></a>');
    return $s3;

in this scenario everything works fine

set endpoint before authentication.