Issues

ZF-2686: Unterminated Loop in Zend_Locale_Format::toNumber

Issue Type: Bug Created: 2008-02-19T05:42:21.000+0000 Last Updated: 2008-03-21T16:25:49.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Marc Bennewitz (GIATA mbH) (mben) Assignee: Thomas Weidner (thomas) Tags: - Zend_Locale

Related issues: Attachments:

Description

<pre class="highlight">
$number = '257';
$format = '#,##';  // wrong format
$locale = new Zend_Locale('de');
Zend_Locale_Format::toNumber($number, array('locale' => $locale, 'number_format'=>$format));

Comments

Posted by Thomas Weidner (thomas) on 2008-02-19T13:56:42.000+0000

Please give us the following data for reproduction: OS, PHP Version, ZF SVN Version, set locale from php, bcmath enabled

Posted by Thomas Weidner (thomas) on 2008-02-19T15:34:57.000+0000

Downgrading to should have and major as we have not got any data for reproduction.

This sort of issue has already been fixed in past for a specific OS so we are not sure if the reporter uses a old release or the failure is unfixed in his OS.

Posted by Marc Bennewitz (GIATA mbH) (mben) on 2008-02-19T16:30:45.000+0000

I have test it in the current revision 8180

  • PHP 5.2.5
  • WinXP SP2 -> setlocale(LC_ALL, 0) -> "LC_COLLATE=C;LC_CTYPE=German_Germany.1252;LC_MONETARY=C;LC_NUMERIC=C;LC_TIME=C" -> extension_loaded('bcmath') -> true
  • SuSE 10.3 -> comming soon tomorow
<pre class="highlight">
           // $number == 257
           // $seperation == -1
           // line 446 in Zend_Locale_Format:
            for ($x = iconv_strlen($number); $x > $seperation; $x -= $seperation) {
                if (iconv_substr($number, 0, $x - $seperation) !== "") {
                    $number = iconv_substr($number, 0, $x - $seperation) . $symbols['group']
                             . iconv_substr($number, $x - $seperation);
                }
            }

Posted by Thomas Weidner (thomas) on 2008-02-20T16:21:44.000+0000

toNumber now throws an exception on wrong formats.... In your case an zero is missing.

Correct formats have to limit the number with an "0" before the precision. This was fixed with ZF-8229

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