|
@@ -806,10 +806,20 @@ class StubNumberFormatterTest extends LocaleTestCase
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
$this->assertEquals(2147483647, $parsedValue);
|
|
|
|
|
|
- // Look that the parsing of '-2,147,483,648' results in a float like the literal -2147483648
|
|
|
$parsedValue = $formatter->parse('-2,147,483,648', \NumberFormatter::TYPE_INT64);
|
|
|
- $this->assertInternalType('float', $parsedValue);
|
|
|
- $this->assertEquals(((float) -2147483647 - 1), $parsedValue);
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // The negative PHP_INT_MAX was being converted to float
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) ||
|
|
|
+ version_compare(PHP_VERSION, '5.4.4', '>=')
|
|
|
+ ) {
|
|
|
+ $this->assertInternalType('int', $parsedValue);
|
|
|
+ } else {
|
|
|
+ $this->assertInternalType('float', $parsedValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assertEquals(-2147483648, $parsedValue);
|
|
|
}
|
|
|
|
|
|
public function testParseTypeInt64StubWith32BitIntegerInPhp64Bit()
|
|
@@ -857,11 +867,31 @@ class StubNumberFormatterTest extends LocaleTestCase
|
|
|
|
|
|
$parsedValue = $formatter->parse('2,147,483,648', \NumberFormatter::TYPE_INT64);
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
- $this->assertEquals(-2147483647 - 1, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // A 32 bit integer was being generated instead of a 64 bit integer
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.3.14', '<')) ||
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
|
|
|
+ ) {
|
|
|
+ $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
|
|
+ } else {
|
|
|
+ $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
|
|
+ }
|
|
|
|
|
|
$parsedValue = $formatter->parse('-2,147,483,649', \NumberFormatter::TYPE_INT64);
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
- $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // A 32 bit integer was being generated instead of a 64 bit integer
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.3.14', '<')) ||
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
|
|
|
+ ) {
|
|
|
+ $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
|
|
+ } else {
|
|
|
+ $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Intl Tests
|
|
@@ -877,10 +907,20 @@ class StubNumberFormatterTest extends LocaleTestCase
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
$this->assertEquals(2147483647, $parsedValue);
|
|
|
|
|
|
- // Look that the parsing of '-2,147,483,648' results in a float like the literal -2147483648
|
|
|
$parsedValue = $formatter->parse('-2,147,483,648', \NumberFormatter::TYPE_INT64);
|
|
|
- $this->assertInternalType('float', $parsedValue);
|
|
|
- $this->assertEquals(((float) -2147483647 - 1), $parsedValue);
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // The negative PHP_INT_MAX was being converted to float.
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '<') && version_compare(PHP_VERSION, '5.3.14', '>=')) ||
|
|
|
+ version_compare(PHP_VERSION, '5.4.4', '>=')
|
|
|
+ ) {
|
|
|
+ $this->assertInternalType('int', $parsedValue);
|
|
|
+ } else {
|
|
|
+ $this->assertInternalType('float', $parsedValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->assertEquals(-2147483648, $parsedValue);
|
|
|
}
|
|
|
|
|
|
public function testParseTypeInt64IntlWith32BitIntegerInPhp64Bit()
|
|
@@ -931,11 +971,31 @@ class StubNumberFormatterTest extends LocaleTestCase
|
|
|
|
|
|
$parsedValue = $formatter->parse('2,147,483,648', \NumberFormatter::TYPE_INT64);
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
- $this->assertEquals(-2147483647 - 1, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // A 32 bit integer was being generated instead of a 64 bit integer
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.3.14', '<')) ||
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
|
|
|
+ ) {
|
|
|
+ $this->assertEquals(-2147483648, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
|
|
+ } else {
|
|
|
+ $this->assertEquals(2147483648, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
|
|
+ }
|
|
|
|
|
|
$parsedValue = $formatter->parse('-2,147,483,649', \NumberFormatter::TYPE_INT64);
|
|
|
$this->assertInternalType('integer', $parsedValue);
|
|
|
- $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range.');
|
|
|
+
|
|
|
+ // Bug #59597 was fixed on PHP 5.3.14 and 5.4.4
|
|
|
+ // A 32 bit integer was being generated instead of a 64 bit integer
|
|
|
+ if (
|
|
|
+ (version_compare(PHP_VERSION, '5.3.14', '<')) ||
|
|
|
+ (version_compare(PHP_VERSION, '5.4.0', '>=') && version_compare(PHP_VERSION, '5.4.4', '<'))
|
|
|
+ ) {
|
|
|
+ $this->assertEquals(2147483647, $parsedValue, '->parse() TYPE_INT64 does not use true 64 bit integers, using only the 32 bit range (PHP < 5.3.14 and PHP < 5.4.4).');
|
|
|
+ } else {
|
|
|
+ $this->assertEquals(-2147483649, $parsedValue, '->parse() TYPE_INT64 uses true 64 bit integers (PHP >= 5.3.14 and PHP >= 5.4.4).');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|