Bug #53775 [Com]: parseCurrency returns 0 instead of false
Edit report at http://bugs.php.net/bug.php?id=53775&edit=1
ID: 53775
Comment by: _coola_ at arcor dot de
Reported by: _coola_ at arcor dot de
Summary: parseCurrency returns 0 instead of false
Status: Bogus
Type: Bug
Package: I18N and L10N related
Operating System: win xp
PHP Version: 5.3SVN-2011-01-18 (SVN)
Block user comment: N
Private report: N
New Comment:
1st parameter has to be a string
http://php.net/manual/en/numberformatter.parsecurrency.php
Previous Comments:
------------------------------------------------------------------------
[2011-01-18 14:01:59] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The parseCurrency() expects the 1st parameter to be a float, when given
a string
PHP automatically casts it to float resulting in 0.
------------------------------------------------------------------------
[2011-01-18 09:56:58] _coola_ at arcor dot de
Description:
------------
Hi! :)
I think i have found a bug in NumberFormatter.
parseCurrency() returns 0 instead of false in the following test
script.
Same Problem with parse().
Test script:
---------------
$fmt=new NumberFormatter('de_DE',NumberFormatter::CURRENCY);
$result=$fmt->parseCurrency('aaa',$currency);
//$result=$fmt->parse('aaa');
// results:
var_dump($result); // float(0)
var_dump($currency); // string(0) ""
// no errors!!
var_dump($fmt->getErrorCode()); // int(0)
var_dump($fmt->getErrorMessage()); // string(12)
"U_ZERO_ERROR"
var_dump(intl_is_failure($fmt->getErrorCode())); // bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53775&edit=1
Thread (5 messages)