Keep big integer as integer instead of lossely casting to float
Closes #874 Fixes #1135
This commit is contained in:
parent
d7d67ff39b
commit
5441b2fa73
|
@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
- Formula Parser: Wrong line count for stuff like "MyOtherSheet!A:D" [#1215](https://github.com/PHPOffice/PhpSpreadsheet/issues/1215)
|
- Formula Parser: Wrong line count for stuff like "MyOtherSheet!A:D" [#1215](https://github.com/PHPOffice/PhpSpreadsheet/issues/1215)
|
||||||
- Call garbage collector after removing a column to prevent stale cached values
|
- Call garbage collector after removing a column to prevent stale cached values
|
||||||
- Trying to remove a column that doesn't exist deletes the latest column
|
- Trying to remove a column that doesn't exist deletes the latest column
|
||||||
|
- Keep big integer as integer instead of lossely casting to float [#874](https://github.com/PHPOffice/PhpSpreadsheet/pull/874)
|
||||||
|
|
||||||
## [1.9.0] - 2019-08-17
|
## [1.9.0] - 2019-08-17
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ class Cell
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DataType::TYPE_NUMERIC:
|
case DataType::TYPE_NUMERIC:
|
||||||
$this->value = (float) $pValue;
|
$this->value = 0 + $pValue;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DataType::TYPE_FORMULA:
|
case DataType::TYPE_FORMULA:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace PhpOffice\PhpSpreadsheetTests\Cell;
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class CellTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @dataProvider providerSetValueExplicit
|
||||||
|
*
|
||||||
|
* @param mixed $expected
|
||||||
|
* @param mixed $value
|
||||||
|
* @param string $dataType
|
||||||
|
*/
|
||||||
|
public function testSetValueExplicit($expected, $value, string $dataType)
|
||||||
|
{
|
||||||
|
$spreadsheet = new Spreadsheet();
|
||||||
|
$cell = $spreadsheet->getActiveSheet()->getCell('A1');
|
||||||
|
$cell->setValueExplicit($value, $dataType);
|
||||||
|
|
||||||
|
self::assertSame($expected, $cell->getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function providerSetValueExplicit()
|
||||||
|
{
|
||||||
|
return require 'data/Cell/SetValueExplicit.php';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
||||||
|
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
1234567890123456789,
|
||||||
|
'01234567890123456789',
|
||||||
|
DataType::TYPE_NUMERIC,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
123.456,
|
||||||
|
'123.456',
|
||||||
|
DataType::TYPE_NUMERIC,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1234567890123456789,
|
||||||
|
1234567890123456789,
|
||||||
|
DataType::TYPE_NUMERIC,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
123.456,
|
||||||
|
123.456,
|
||||||
|
DataType::TYPE_NUMERIC,
|
||||||
|
],
|
||||||
|
];
|
Loading…
Reference in New Issue