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-25 04:22 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: No Feedback Package: I18N and L10N related
PHP Version: 5.3.5 OS: all ? windows7 x64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
24 + 23 = ?
Subscribe to this entry?

 
 [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>
 [2020-10-25 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 20:01:31 2024 UTC