General: Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric
This commit is contained in:
parent
31d60ad524
commit
d4a641c5c7
|
@ -76,31 +76,25 @@ class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||||
// Match the value against a few data types
|
// Match the value against a few data types
|
||||||
if (is_null($pValue)) {
|
if (is_null($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||||
|
|
||||||
} elseif ($pValue === '') {
|
} elseif ($pValue === '') {
|
||||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
|
||||||
} elseif ($pValue instanceof PHPExcel_RichText) {
|
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||||
|
|
||||||
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||||
|
|
||||||
} elseif (is_bool($pValue)) {
|
} elseif (is_bool($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||||
|
|
||||||
} elseif (is_float($pValue) || is_int($pValue)) {
|
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
|
||||||
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
} elseif (preg_match('/^\-?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)$/', $pValue)) {
|
||||||
|
if (is_string($pValue) && $pValue{0} === '0' && strlen($pValue) > 1 && $pValue{1} !== '.' ) {
|
||||||
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
}
|
||||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||||
|
|
||||||
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||||
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ Planned for v1.8.1
|
||||||
- Bugfix: (MBaker) - Fix to getStyle() call for cell object
|
- Bugfix: (MBaker) - Fix to getStyle() call for cell object
|
||||||
- General: (MBaker) - Small performance improvement for autosize columns
|
- General: (MBaker) - Small performance improvement for autosize columns
|
||||||
- General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case
|
- General: (frost-nzcr4) Work Item GH-379 - Change the getter/setter for zeroHeight to camel case
|
||||||
|
- General: (MBaker) Work Item GH-394 - DefaultValueBinder is too much aggressive when converting string to numeric
|
||||||
- Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines
|
- Feature: (WiktrzGE) Work Item GH-404 - Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines
|
||||||
- Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell
|
- Feature: (frost-nzcr4) Work Item GH-403 - ODS read/write comments in the cell
|
||||||
- Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions
|
- Feature: (CQD) Work Item GH-389 - Additional Mac CJK codepage definitions
|
||||||
|
|
Loading…
Reference in New Issue