Issues

ZF-9181: Wrong condition in Zend_Currency constructor makes the whole component unusable

Issue Type: Bug Created: 2010-02-15T06:41:23.000+0000 Last Updated: 2010-02-15T13:33:17.000+0000 Status: Resolved Fix version(s): - 1.10.2 (24/Feb/10)

Reporter: Nicolas Grevet (nyko18) Assignee: Thomas Weidner (thomas) Tags: - Zend_Currency

Related issues: Attachments:

Description

In our project, we're using Zend_Currency to handle prices, but so far, we've been unable to make it work. Even the simplest example from the documentation throws an error:

This one works: {quote} new Zend_Currency( array('value' => 100) ); {quote}

This one fails: {quote} new Zend_Currency( array('value' => 100.50) ); {quote}

Type: Zend_Cache_Exception Message: Invalid id or tag 'Zend_LocaleC_fr_FR_currencytoname_100.5' : must use only [a-zA-Z0-9_]

As soon as we're using anything else than an integer, it fails. Zend_Currency tries to cache something under a wrong cache identifier because of a single malformed condition in the Zend_Currency constructor:

The line 103: if (!isset($options['currency']) || !is_array($options)) {

Should read: if (!isset($this->_options['currency']) || !is_array($options)) {

In Zend_Currency::setLocale() just above (line 101), the 'currency' option is set by default if missing, this makes the whole following condition pass although it should not. Moreover, this does not seem correct that Zend_Currency puts the value of the currency (100.50) in the 'currency' option, there could be another problem somewhere.

Comments

Posted by Thomas Weidner (thomas) on 2010-02-15T13:33:16.000+0000

Fixed with r21059

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