Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.
This repository was archived by the owner on Jan 2, 2019. It is now read-only.

Bug - Datetime at DefaultValueBinder #543

@phackwer

Description

@phackwer

Greetings!

Line 86 is buggy since it didn't check if the value of the array is an object or instance of DateTime.

Here is the fix! A small check of time and conversion to string.

format('Y-m-d H:i:s'); } else if (is_object($value)) { $value = $value->__toString(); } // Set value explicit $cell->setValueExplicit( $value, self::dataTypeForValue($value) ); // Done! return TRUE; } /** - DataType for value * - @param mixed $pValue - @return string _/ public static function dataTypeForValue($pValue = null) { // Match the value against a few data types if (is_null($pValue)) { return PHPExcel_Cell_DataType::TYPE_NULL; } elseif ($pValue === '') { return PHPExcel_Cell_DataType::TYPE_STRING; } elseif ($pValue instanceof PHPExcel_RichText) { return PHPExcel_Cell_DataType::TYPE_INLINE; } elseif ($pValue{0} === '=' && strlen($pValue) > 1) { return PHPExcel_Cell_DataType::TYPE_FORMULA; } elseif (is_bool($pValue)) { return PHPExcel_Cell_DataType::TYPE_BOOL; } elseif (is_float($pValue) || is_int($pValue)) { return PHPExcel_Cell_DataType::TYPE_NUMERIC; } elseif (preg_match('/^-?([0-9]+\.?[0-9]_|[0-9]*\.?[0-9]+)$/', $pValue)) { return PHPExcel_Cell_DataType::TYPE_NUMERIC; } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) { return PHPExcel_Cell_DataType::TYPE_ERROR; } else { return PHPExcel_Cell_DataType::TYPE_STRING; } } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions