Issues

ZF-11023: Zend_Service_Twitter constructor could not use Zend_Config

Description

Hi.

Could Zend_Service_Twitter's constructor use Zend_Config? If $options is Zend_Config instance, it's seems to cast to an array.


public function __construct($options = null, Zend_Oauth_Consumer $consumer = null)
{
    $this->setUri('http://api.twitter.com');
    if (!is_array($options)) $options = array();
    $options['siteUrl'] = self::OAUTH_BASE_URI;
    if ($options instanceof Zend_Config) {
        $options = $options->toArray();
    }
    $this->_options = $options;

If it's ok to use Zend_Config, constructor should be like this.


public function __construct($options = null, Zend_Oauth_Consumer $consumer = null)
{
    $this->setUri('http://api.twitter.com');
-   if (!is_array($options)) $options = array();
-   $options['siteUrl'] = self::OAUTH_BASE_URI;
    if ($options instanceof Zend_Config) {
        $options = $options->toArray();
    }
+   if (!is_array($options)) $options = array();
+   $options['siteUrl'] = self::OAUTH_BASE_URI;

Regards.

Comments

This is bug and not a improvement.

Fixed in trunk r23698 merged to branch release 1.11 r23699.