php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59597 NumberFormatter::parse() with TYPE_INT64 results in a 32 bit integer
Submitted: 2011-01-30 02:34 UTC Modified: 2012-04-19 18:39 UTC
From: eriksencosta at gmail dot com Assigned: stas (profile)
Status: Closed Package: intl (PECL)
PHP Version: 5.3.2 OS: Ubuntu 10.10
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eriksencosta at gmail dot com
New email:
PHP Version: OS:

 

 [2011-01-30 02:34 UTC] eriksencosta at gmail dot com
Description:
------------
First, my PHP version is 5.3.5. The bugtracker have this version missing.

I was testing the \NumberFormatter class when I got stuck in a behaviour that I don't know if is by design or not.

Simply, I was expecting a 64 bit integer when calling the parse() method with the $type = \NumberFormatter::TYPE_INT64 as my PHP is 64 bit compiled.

Tried searching the ICU bugtracker but don't found something related (but not sure, I'm not a C programmer): http://bugs.icu-project.org/trac/query?project=ICU4C&summary=~NumberFormat&summary=~int64&order=id&desc=1

Mine intl info:

intl

Internationalization support => enabled
version => 1.1.0
ICU version => 4.2.1

Directive => Local Value => Master Value
intl.default_locale => no value => no value
intl.error_level => 0 => 0


Thanks.

Reproduce code:
---------------
<?php

$formatter = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$value = $formatter->parse('2147483647', \NumberFormatter::TYPE_INT32);
var_dump($value);

$formatter = new \NumberFormatter('en', \NumberFormatter::DECIMAL);
$value = $formatter->parse('2147483650', \NumberFormatter::TYPE_INT64);
var_dump($value);

Expected result:
----------------
int(2147483647)
int(2147483650)

Actual result:
--------------
int(2147483647)
int(-2147483646)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-19 18:39 UTC] stas@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2012-04-19 18:39 UTC] stas@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC