Fix CellValueFormatter for numeric values
The value passed into the format() function is coming from an XML file and has never been coerced. Therefore, when checking is_int($value), the check always returns false - because it's a string. Changing the check fixes the issue and Spout now correctly parses large numbers.
This commit is contained in:
1 parent
c48c07db99
commit
4a5da2ad74
3 files changed
+67
-20
No files matched your search
@@ -47,7 +47,6 @@ class CellValueFormatter
|
||||
|
||||
/**
|
||||
* Returns the (unescaped) correctly marshalled, cell value associated to the given XML node.
|
||||
* @TODO Add other types !!
|
||||
* @see http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#refTable13
|
||||
*
|
||||
* @param \DOMNode $node
|
||||
@@ -119,7 +118,8 @@ class CellValueFormatter
|
||||
protected function formatFloatCellValue($node)
|
||||
{
|
||||
$nodeValue = $node->getAttribute(self::XML_ATTRIBUTE_VALUE);
|
||||
$cellValue = is_int($nodeValue) ? intval($nodeValue) : floatval($nodeValue);
|
||||
$nodeIntValue = intval($nodeValue);
|
||||
$cellValue = ($nodeIntValue == $nodeValue) ? $nodeIntValue : floatval($nodeValue);
|
||||
return $cellValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user