ZF-9941: Zend_Currency::toCurrency() options
Description
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.
Comments
Posted by Thomas Weidner (thomas) on 2010-06-03T04:45:28.000+0000
The framework code works like expected. Please give some reproduceable code for the problem you have.
Posted by Aurimas Likas (fokusininkas) on 2010-06-03T05:42:08.000+0000
$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:
because null !== array()
Posted by Thomas Weidner (thomas) on 2010-06-04T07:56:23.000+0000
Fixed with r22369