Issue

ZF-10182: Zend_Oauth_Client in your constructor should accepts array and object config.

Issue Type: Improvement Created: 2010-07-19T20:29:20.000+0000 Last Updated: 2011-07-30T03:14:19.000+0000 Status: Closed Fix version(s): - 1.11.0 (02/Nov/10)

  • 1.11.10 (04/Aug/11)

Reporter: Ramon Henrique Ornelas (ramon) Assignee: Ramon Henrique Ornelas (ramon) Tags: - Zend_Oauth

Related issues: Attachments:

Description

Big problem only the type hinting in constructor already that your code internal is prepared for this behavior.

See Zend_Oauth_Client line 82 the 84.

<pre class="highlight">
if ($oauthOptions instanceof Zend_Config) {
    $oauthOptions = $oauthOptions->toArray();
}

Comments

Posted by Ramon Henrique Ornelas (ramon) on 2010-08-19T05:00:47.000+0000

Fixed with r22650.

Posted by Till Klampaeckel (till) on 2011-05-20T15:44:12.000+0000

This is not fixed.

  1. Update the docblock for the first parameter.

  2. The third parameter supposedly supports both too, but when Zend_Config is supplied, it errors because it tries to access the config using array notation.

         /**
          * Constructor; creates a new HTTP Client instance which itself is
          * just a typical Zend_Http_Client subclass with some OAuth icing to
          * assist in automating OAuth parameter generation, addition and
          * cryptographioc signing of requests.
          *
          * @param  array $oauthOptions
          * @param  string $uri
          * @param  array|Zend_Config $config
          * @return void
          */
         public function __construct($oauthOptions, $uri = null, $config = null)
         {
             if (!isset($config['rfc3986_strict'])) {
                 $config['rfc3986_strict'] = true;
             }
    
    
    
    
    
    

Posted by Till Klampaeckel (till) on 2011-05-20T15:45:45.000+0000

Here's a patch for you:

<pre class="highlight">
Index: Client.php
===================================================================
--- Client.php  (revision 8)
+++ Client.php  (working copy)
@@ -76,8 +76,13 @@
      */
     public function __construct($oauthOptions, $uri = null, $config = null)
     {
-        if (!isset($config['rfc3986_strict'])) {
-            $config['rfc3986_strict'] = true;
+        if ($config !== null) {
+            if ($config instanceof Zend_Config) {
+                $config = $config->toArray();
+            }
+            if (!isset($config['rfc3986_strict'])) {
+                $config['rfc3986_strict'] = true;
+            }
         }
         parent::__construct($uri, $config);
         $this->_config = new Zend_Oauth_Config;

Posted by Ramon Henrique Ornelas (ramon) on 2011-07-30T03:14:19.000+0000

Fix config http client how Zend_Config r24311.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2017 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts