|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-12-30 16:49 UTC] sfox@php.net
Description:
------------
To start with, this is CVS from over a week ago (PHP_5_3 and PECL) but I can see from the commit list that it hasn't been fixed in the interim. The bug tracking system doesn't allow me to tell you this much. The ICU version I built PHP against is 3.4 (from Edin's library collection). I haven't tried yet with 3.4.1 or up.
I've tried with and without the currency symbol; I've tried shifting the position to match the first digit rather than the currency symbol; I've tried different currencies. The straightforward parse() method works perfectly, but the currencyParse() method does not - at least on my box.
Reproduce code:
---------------
<?php
$nf = new NumberFormatter('en_US', NumberFormatter::CURRENCY);
$pos = 13;
print $nf->parseCurrency("When parsing ".$nf->format(123)." this will return false, or at least a hidden error", $currency, $pos)."\n";
print $currency."\n";
print $pos."\n";
print intl_get_error_message();
?>
Expected result:
----------------
123
USD
20 // note: I'm guessing wildly here. Above 13 anyway.
U_ZERO_ERROR
Actual result:
--------------
13
Number parsing failed: U_PARSE_ERROR
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
Nope, it gives currency sign, decimal point + two decimal places... I put that in the test script because I'd tried all the variations manually before posting a bug report. If it works for you though it still seems most likely an old ICU bug, I'd just like to be certain. $nf = new NumberFormatter('en_US', NumberFormatter::CURRENCY); print $nf->format(123); //$123.00