ZF-9941: Zend_Currency::toCurrency() options


I think there is a bug in Zend/Currency.php, Line: 140:

if (is_array($value) && isset($options['value'])) {

.. which should be :

if (isset($options['value'])) {

.. because if variable $value is strictly null it will never by an array and 'value' from the options array will be skipped and the one from $this->_options will be used.


The framework code works like expected. Please give some reproduceable code for the problem you have.

$currency = new Zend_Currency( array( 'value' => 1000, ) );

echo $currency->toCurrency(null, array('value' => 2000)); // 1000

I think it should return 2000. Though if it is expected behavior the statement in Line #139 remains pointless:

    if ($value === null) {
        if (is_array($value) && isset($options['value'])) {

because null !== array()

Fixed with r22369