Issues

ZF-10676: getList() doesn't return array if no translations are available in adapter

Issue Type: Bug Created: 2010-11-12T10:01:13.000+0000 Last Updated: 2010-12-18T09:30:20.000+0000 Status: Resolved Fix version(s): - 1.11.2 (30/Dec/10)

  • Next Major Release ()

Reporter: Alexander Grimalovsky (flying) Assignee: Thomas Weidner (thomas) Tags: - Zend_Translate

Related issues: Attachments: - ZF-10676.patch

Description

PHPdoc comment for Zend_Translate_Adapter::getList() declares that method will always return array, but in a case if there is no translations are available in adapter it returns NULL.

From source code:

/**
 * Returns the available languages from this adapter
 *
 * @return array
 */
public function getList()
{
    $list = array_keys($this->_translate);
    $result = null;    // <--- This is wrong, it should be $result = array();
    foreach($list as $value) {
        if (!empty($this->_translate[$value])) {
            $result[$value] = $value;
        }
    }
    return $result;
}

Comments

Posted by Oleg Lobach (bladeofsteel) on 2010-11-18T12:41:20.000+0000

Here is small patch to fix this typo bug

Posted by Oleg Lobach (bladeofsteel) on 2010-11-18T12:48:14.000+0000

Check my trivial patch, plz.

Posted by Oleg Lobach (bladeofsteel) on 2010-12-16T05:44:41.000+0000

Fixed with SVN:r23517 and SVN:r23518

Posted by Thomas Weidner (thomas) on 2010-12-18T09:28:38.000+0000

Fixed with 11.Dec. Accepted for ZF2 with 17.Dec.

Posted by Thomas Weidner (thomas) on 2010-12-18T09:30:20.000+0000

Note that the patch for 1.11 is incorrect

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 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