Zend Framework

Zend_Oauth_Client in your constructor should accepts array and object config.

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.10.6, 1.11.6
  • Fix Version/s: 1.11.0, 1.11.10
  • Component/s: Zend_Oauth
  • Labels:
    None

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.

if ($oauthOptions instanceof Zend_Config) {
    $oauthOptions = $oauthOptions->toArray();
}

Activity

Hide
Ramon Henrique Ornelas added a comment -

Fixed with r22650.

Show
Ramon Henrique Ornelas added a comment - Fixed with r22650.
Hide
Till Klampaeckel added a comment -

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;
        }
Show
Till Klampaeckel added a comment - 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;
        }
Hide
Till Klampaeckel added a comment -

Here's a patch for you:

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;
Show
Till Klampaeckel added a comment - Here's a patch for you:
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;
Hide
Ramon Henrique Ornelas added a comment -

Fix config http client how Zend_Config r24311.

Show
Ramon Henrique Ornelas added a comment - Fix config http client how Zend_Config r24311.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: