php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54294 wrong result when parse ::ORDINAL strings ->parse("2nd")
Submitted: 2011-03-17 15:00 UTC Modified: 2020-10-13 11:30 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: giorgio dot liscio at email dot it Assigned: cmb (profile)
Status: Feedback Package: I18N and L10N related
PHP Version: 5.3.5 OS: all ? windows7 x64
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-03-17 15:00 UTC] giorgio dot liscio at email dot it
Description:
------------
hi

define("E", "\n");

$round = new \NumberFormatter("en", \NumberFormatter::ORDINAL);
echo $round->format(6).E; // OUTPUTS 6th
	
$round = new \NumberFormatter("en", \NumberFormatter::ORDINAL);
echo var_dump($round->parse("6th")).E; // OUTPUTS float 122!!!
echo $round->getErrorMessage().E; // ZERO ERROR



gives me error only with "en-*" locale

this works good:

$round = new \NumberFormatter("it_IT", \NumberFormatter::ORDINAL);
echo var_dump($round->parse("6°")).E; // OUTPUTS float 6
echo var_dump($round->parse("123esimo")).E; // OUTPUTS float 123
echo $round->getErrorMessage().E; // ZERO ERROR



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-13 11:30 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-13 11:30 UTC] cmb@php.net
I cannot reproduce: <https://3v4l.org/hLYvp>.  Might have been a
bug in PHP 5.3/5.4 or an upstream bug, which has been fixed in the
meantime.  Or can you still reproduce this with any of the
actively supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Oct 24 18:01:28 2020 UTC