ZF-9941: Zend_Currency::toCurrency() options

Issue Type: Bug Created: 2010-06-03T04:36:19.000+0000 Last Updated: 2010-06-04T07:56:27.000+0000 Status: Resolved Fix version(s): - 1.10.6 (22/Jun/10)

Reporter: Aurimas Likas (fokusininkas) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

Related issues: Attachments:


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.


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:

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

because null !== array()

Posted by Thomas Weidner (thomas) on 2010-06-04T07:56:23.000+0000

Fixed with r22369

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.