ZF-11960: Zend_Locale_Format::toNumber() produces no percent sign when used with 'number_format' => Zend_Locale_Data::getFormat('en', 'percentnumber');

Issue Type: Bug Created: 2011-12-29T17:38:43.000+0000 Last Updated: 2012-01-05T16:19:35.000+0000 Status: Open Fix version(s): Reporter: Bruce Weirdan (weirdan) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:


Steps to reproduce: run

<pre class="highlight">
    $n = 3000.1;                                                                                                                                                         
    $f = Zend_Locale_Data::getContent('en_GB', 'percentnumber');                                                                                                         
    $out = Zend_Locale_Format::toNumber($n, array('number_format' => $f, 'locale' => 'en_GB'));
    assert('false !== strpos($out, "%")');

Expected results: Assertion does not fail

Actual results:

<pre class="highlight">
 PHP Warning:  assert(): Assertion "false !== strpos($out, "%")" failed in ../e.php on line 6
 PHP Stack trace:
 PHP   1. {main}() ../e.php:0
 PHP   2. assert() ../e.php:5

Even though I found this issue in 1.11.8 I believe it affects later versions as well. In 1.7.9 this was working as expected.


Posted by Shinya Hayakawa (tsurumau) on 2012-01-05T16:19:35.000+0000

As long as I read the implementation of Zend_Locale_Format::toNumber(), it seems to accept only format tokens.(i.e. #0,.) Assuming that it is appropriate, where should we use percent number format etc?

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.